3.1.2 ASN.1 Syntax for DER-encoding Public Key used for Encryption
The Diffie-Hellman public key used for ElGamal encryption MUST be DER-encoded as follows (using ASN.1 syntax):
-
DHPublicKeyForElGamalEncryption::= SEQUENCE { p INTEGER, -- prime, p q INTEGER OPTIONAL, -- factor of p-1, only present when p = j*q+1, -- where j is not 2 g INTEGER, -- generator, g y INTEGER -- public key (g^x mod p, where x is the private key) }
Diffie-Hellman is a cryptographic key exchange protocol that allows two parties that have no prior knowledge of each other to jointly establish a shared secret over an insecure communications channel, as specified in [CRYPTO].
Rivest, Shamir and Adleman (RSA) is a cryptographic protocol as specified in [CRYPTO].
The RSA public key used for RSA encryption MUST be DER-encoded as follows (using ASN.1 syntax):
-
RSAPublicKeyForRSAEncryption::= SEQUENCE { modulus INTEGER, -- the RSA modulus n publicExponent INTEGER -- the RSA public exponent e }