org.minidns.record

## Class DNSKEY

- java.lang.Object
- - org.minidns.record.Data
  - - org.minidns.record.DNSKEY

-     public class DNSKEY
      extends Data

  DNS DNSKEY record payload for DNSSEC public keys.
  Contains a DNSSEC public key used to verify DNSSEC signatures for a DNS zone.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `DnssecConstants.SignatureAlgorithm` | `algorithm` The public key's cryptographic algorithm used.
    `byte` | `algorithmByte` The byte value of the public key's cryptographic algorithm used.
    `static short` | `FLAG_REVOKE` Whether the record holds a revoked key.
    `static short` | `FLAG_SECURE_ENTRY_POINT` Whether the key should be used as a secure entry point key.
    `static short` | `FLAG_ZONE` Whether the record holds a DNS zone key.
    `short` | `flags` Bitmap of flags: `FLAG_SECURE_ENTRY_POINT`, `FLAG_REVOKE`, `FLAG_ZONE`.
    `byte` | `protocol` Must be `PROTOCOL_RFC4034`.
    `static byte` | `PROTOCOL_RFC4034` Use the protocol defined in RFC 4034.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DNSKEY(short flags, byte protocol, byte algorithm, byte[] key)`
    `DNSKEY(short flags, byte protocol, DnssecConstants.SignatureAlgorithm algorithm, byte[] key)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getKey()`
    `DataInputStream` | `getKeyAsDataInputStream()`
    `String` | `getKeyBase64()`
    `BigInteger` | `getKeyBigInteger()`
    `int` | `getKeyLength()`
    `int` | `getKeyTag()` Retrieve the key tag identifying this DNSKEY.
    `Record.TYPE` | `getType()` The payload type.
    `boolean` | `isSecureEntryPoint()`
    `boolean` | `keyEquals(byte[] otherKey)`
    `static DNSKEY` | `parse(DataInputStream dis, int length)`
    `void` | `serialize(DataOutputStream dos)` The internal method used to serialize Data subclasses.
    `String` | `toString()`

    - ### Methods inherited from class org.minidns.record.Data

      `equals, hashCode, length, toByteArray, toOutputStream, toOutputStream`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### algorithm

          public final DnssecConstants.SignatureAlgorithm algorithm

      The public key's cryptographic algorithm used.

    - #### algorithmByte

          public final byte algorithmByte

      The byte value of the public key's cryptographic algorithm used.

    - #### FLAG_REVOKE

          public static final short FLAG_REVOKE

      Whether the record holds a revoked key.
      See Also:
        Constant Field Values

    - #### FLAG_SECURE_ENTRY_POINT

          public static final short FLAG_SECURE_ENTRY_POINT

      Whether the key should be used as a secure entry point key. see RFC 3757
      See Also:
        Constant Field Values

    - #### FLAG_ZONE

          public static final short FLAG_ZONE

      Whether the record holds a DNS zone key.
      See Also:
        Constant Field Values

    - #### flags

          public final short flags

      Bitmap of flags: `FLAG_SECURE_ENTRY_POINT`, `FLAG_REVOKE`, `FLAG_ZONE`.
      See Also:
        IANA - DNSKEY RR Flags

    - #### protocol

          public final byte protocol

      Must be `PROTOCOL_RFC4034`.

    - #### PROTOCOL_RFC4034

          public static final byte PROTOCOL_RFC4034

      Use the protocol defined in RFC 4034.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DNSKEY

          public DNSKEY(short flags,
                        byte protocol,
                        byte algorithm,
                        byte[] key)

    - #### DNSKEY

          public DNSKEY(short flags,
                        byte protocol,
                        DnssecConstants.SignatureAlgorithm algorithm,
                        byte[] key)

  - ### Method Detail

    - #### getKey

          public byte[] getKey()

    - #### getKeyAsDataInputStream

          public DataInputStream getKeyAsDataInputStream()

    - #### getKeyBase64

          public String getKeyBase64()

    - #### getKeyBigInteger

          public BigInteger getKeyBigInteger()

    - #### getKeyLength

          public int getKeyLength()

    - #### getKeyTag

          public int getKeyTag()

      Retrieve the key tag identifying this DNSKEY. The key tag is used within the DS and RRSIG record to distinguish multiple keys for the same name. This implementation is based on the reference implementation shown in RFC 4034 Appendix B.
      Returns:
        this DNSKEY's key tag

    - #### getType

          public Record.TYPE getType()

      Description copied from class: `Data`
      The payload type.
      Specified by:
        `getType` in class `Data`
      Returns:
        The payload type.

    - #### isSecureEntryPoint

          public boolean isSecureEntryPoint()

    - #### keyEquals

          public boolean keyEquals(byte[] otherKey)

    - #### parse

          public static DNSKEY parse(DataInputStream dis,
                                     int length)
                              throws IOException

      Throws:
        `IOException`

    - #### serialize

          public void serialize(DataOutputStream dos)
                         throws IOException

      Description copied from class: `Data`
      The internal method used to serialize Data subclasses.
      Specified by:
        `serialize` in class `Data`
      Parameters:
        `dos` - the output stream to serialize to.
      Throws:
        `IOException` - if an I/O error occurs.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`