Subject: | pubkey method needs better documentation |
The pubkey method does not return the public key, rather, it returns a
BIT STRING that needs to be ASN-decoded in order to access the actual
public key. This results in the pubkey_size method also being incorrect
(it simply returns the length of this BIT STRING).
Depending on the public-key algorithm (RSA, DSA, etc.) the decoded
public-key structure will be different.
The decoding for RSA looks like this:
RSAPublicKey ::= SEQUENCE {
modulus INTEGER, -- n
publicExponent INTEGER -- e --
}
The decoding for DSA looks like this:
DSAPublicKey ::= INTEGER -- public key, Y