Class DNSKEYRecord
Public key cryptography to sign and authenticate resource records.
Inherited Members
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.dll
Syntax
public class DNSKEYRecord : ResourceRecord, IWireSerialiser, ICloneable, IPresentationSerialiser
Constructors
| Improve this Doc View SourceDNSKEYRecord()
Creates a new instance of the DNSKEYRecord class.
Declaration
public DNSKEYRecord()
DNSKEYRecord(ECDsa)
Creates a new instance of the DNSKEYRecord class from the specified ECDSA key.
Declaration
public DNSKEYRecord(ECDsa key)
Parameters
| Type | Name | Description |
|---|---|---|
| ECDsa | key | A public or private ECDSA key. |
Remarks
note
ECDSA key support is NOT available for NETSTANDARD14 nor NET45. It is available for NETSTANDARD2, NET472 or greater.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| CryptographicException |
|
DNSKEYRecord(RSA, SecurityAlgorithm)
Creates a new instance of the DNSKEYRecord class from the specified RSA key.
Declaration
public DNSKEYRecord(RSA key, SecurityAlgorithm algorithm)
Parameters
| Type | Name | Description |
|---|---|---|
| RSA | key | A public or private RSA key. |
| SecurityAlgorithm | algorithm | The security algorithm to use. Only RSA types are allowed. |
Properties
| Improve this Doc View SourceAlgorithm
Identifies the public key's cryptographic algorithm.
Declaration
public SecurityAlgorithm Algorithm { get; set; }
Property Value
| Type | Description |
|---|---|
| SecurityAlgorithm | Identifies the type of key (RSA, ECDSA, ...) and the hashing algorithm. |
Remarks
Determines the format of thePublicKey.
Flags
Identifies the intended usage of the key.
Declaration
public DNSKEYFlags Flags { get; set; }
Property Value
| Type | Description |
|---|---|
| DNSKEYFlags |
Protocol
Must be three.
Declaration
public byte Protocol { get; set; }
Property Value
| Type | Description |
|---|---|
| Byte | Defaults to 3. |
PublicKey
The public key material.
Declaration
public byte[] PublicKey { get; set; }
Property Value
| Type | Description |
|---|---|
| Byte[] | The format depends on the key Algorithm. |
Methods
| Improve this Doc View SourceKeyTag()
Calculates the key tag.
Declaration
public ushort KeyTag()
Returns
| Type | Description |
|---|---|
| UInt16 | A non-unique identifier for the public key. |
Remarks
https://tools.ietf.org/html/rfc4034#appendix-B for the details.
ReadData(PresentationReader)
Read the textual representation of the data that is specific to the resource record Type.
Declaration
public override void ReadData(PresentationReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| PresentationReader | reader | The source of the resource record's data. |
Overrides
Remarks
Derived classes must implement this method.
ReadData(WireReader, Int32)
Read the data that is specific to the resource record Type.
Declaration
public override void ReadData(WireReader reader, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| WireReader | reader | The source of the resource record's data. |
| Int32 | length | The length, in bytes, of the data. |
Overrides
Remarks
Derived classes must implement this method.
WriteData(PresentationWriter)
Write the textual representation of the data that is specific to the resource record.
Declaration
public override void WriteData(PresentationWriter writer)
Parameters
| Type | Name | Description |
|---|---|---|
| PresentationWriter | writer | The destination for the resource record's data. |
Overrides
Remarks
Derived classes should implement this method.
By default, this will write the hex encoding of the GetData() preceeded by "#" and the number integer bytes.
WriteData(WireWriter)
Write the data that is specific to the resource record Type.
Declaration
public override void WriteData(WireWriter writer)
Parameters
| Type | Name | Description |
|---|---|---|
| WireWriter | writer | The destination for the DNS object's data. |
Overrides
Remarks
Derived classes must implement this method.