DNSKEYRecord (dnsjava documentation)
Date: 2013-04-10

org.xbill.DNS

## Class DNSKEYRecord

- java.lang.Object
- - org.xbill.DNS.Record
  - - org.xbill.DNS.DNSKEYRecord

- All Implemented Interfaces:
    Serializable, Cloneable, Comparable

      public class DNSKEYRecord
      extends Record

  Key - contains a cryptographic public key for use by DNS. The data can be converted to objects implementing java.security.interfaces.PublicKey
  Author:
    Brian Wellington
  See Also:
    `DNSSEC`, Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DNSKEYRecord.Flags`
    `static class` | `DNSKEYRecord.Protocol`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `alg`
    `protected int` | `flags`
    `protected int` | `footprint`
    `protected byte[]` | `key`
    `protected int` | `proto`
    `protected PublicKey` | `publicKey`

    - ### Fields inherited from class org.xbill.DNS.Record

      `dclass, name, ttl, type`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DNSKEYRecord(Name name, int dclass, long ttl, int flags, int proto, int alg, byte[] key)` Creates a DNSKEY Record from the given data
    `DNSKEYRecord(Name name, int dclass, long ttl, int flags, int proto, int alg, PublicKey key)` Creates a DNSKEY Record from the given data

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getAlgorithm()` Returns the key's algorithm
    `int` | `getFlags()` Returns the flags describing the key's properties
    `int` | `getFootprint()` Returns the key's footprint (after computing it)
    `byte[]` | `getKey()` Returns the binary data representing the key
    `int` | `getProtocol()` Returns the protocol that the key was created for
    `PublicKey` | `getPublicKey()` Returns a PublicKey corresponding to the data in this key.

    - ### Methods inherited from class org.xbill.DNS.Record

      `byteArrayFromString, byteArrayToString, compareTo, equals, fromString, fromString, fromWire, getAdditionalName, getDClass, getName, getRRsetType, getTTL, getType, hashCode, newRecord, newRecord, newRecord, newRecord, rdataToString, rdataToWireCanonical, sameRRset, toString, toWire, toWireCanonical, unknownToString, withName`

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

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

- - ### Field Detail

    - #### flags

          protected int flags

    - #### proto

          protected int proto

    - #### alg

          protected int alg

    - #### key

          protected byte[] key

    - #### footprint

          protected int footprint

    - #### publicKey

          protected PublicKey publicKey

  - ### Constructor Detail

    - #### DNSKEYRecord

          public DNSKEYRecord(Name name,
                      int dclass,
                      long ttl,
                      int flags,
                      int proto,
                      int alg,
                      byte[] key)

      Creates a DNSKEY Record from the given data
      Parameters:
        `flags` - Flags describing the key's properties
        `proto` - The protocol that the key was created for
        `alg` - The key's algorithm
        `key` - Binary representation of the key

    - #### DNSKEYRecord

          public DNSKEYRecord(Name name,
                      int dclass,
                      long ttl,
                      int flags,
                      int proto,
                      int alg,
                      PublicKey key)
                       throws DNSSEC.DNSSECException

      Creates a DNSKEY Record from the given data
      Parameters:
        `flags` - Flags describing the key's properties
        `proto` - The protocol that the key was created for
        `alg` - The key's algorithm
        `key` - The key as a PublicKey
      Throws:
        `DNSSEC.DNSSECException` - The PublicKey could not be converted into DNS format.

  - ### Method Detail

    - #### getFlags

          public int getFlags()

      Returns the flags describing the key's properties

    - #### getProtocol

          public int getProtocol()

      Returns the protocol that the key was created for

    - #### getAlgorithm

          public int getAlgorithm()

      Returns the key's algorithm

    - #### getKey

          public byte[] getKey()

      Returns the binary data representing the key

    - #### getFootprint

          public int getFootprint()

      Returns the key's footprint (after computing it)

    - #### getPublicKey

          public PublicKey getPublicKey()
                                 throws DNSSEC.DNSSECException

      Returns a PublicKey corresponding to the data in this key.
      Throws:
        `DNSSEC.DNSSECException` - The key could not be converted.