D-H private-key blobs (type PRIVATEKEYBLOB) are used to store the public/private information of a D-H key. They have the following format:
BLOBHEADER blobheader; // As explained under "Data Structures"
DHPUBKEY dhpubkey;
BYTE prime[dhpubkey.bitlen/8];
BYTE generator[dhpubkey.bitlen/8];
BYTE secret[dhpubkey.bitlen/8];
The following table describes each component of the key blob.
Field | Description |
---|---|
blobheader | A BLOBHEADER structure. The bType member must have a value of PRIVATEKEYBLOB. |
dhpubkey | A DHPUBKEY structure. The magic member should be set to "DH2" (0x32484400) for private keys. Notice that the hex value is just an ASCII encoding of "DH2." |
prime | The prime modulus P. This data must always have the most significant bit of the most significant byte set to 1. |
generator | The generator G. |
secret | The secret exponent X. |
Note The generator and secret must always be the same length (in bytes). If either is one byte or more shorter than the other, then it must be padded with the necessary number of bytes (of zero value) to make them the same (little-endian format).