Thanks for that Jim. So in that case I'm assuming that the 'Encryptor'
equivalent encodes the public key in X509 format when calling DEREncode
()? E.g.
RSAES_OAEP_SHA_Encryptor public_key (private_key);
HexEncoder public_key_file (
new FileSink (p_pb_file_name.c_str ()));
public_key.DEREncode (public_key_file);
public_key_file.MessageEnd ();
This public_key_file now holds a hex-encoded X509 encoded public key? An
"object" that identifies itself as an RSA public key? Trying to open
this with JCE fails with a BER decode error :-(
Cheers,
Jim
On Mon, 2005-04-18 at 07:38 -0400, Jim Starkey wrote:
> James Vanns wrote:
>
> >All,
> >
> >When writing an RSA private key to a file as below...
> >
> >RSAES_OAEP_SHA_Decryptor private_key (*rng, p_bits);
> >HexEncoder private_key_file (
> > new FileSink p_pv_file_name.c_str ());
> >
> >
> >private_key.DEREncode (private_key_file);
> >private_key_file.MessageEnd ();
> >
> >Can anyone confirm the format it has been saved in? By this I mean that
> >too me it looks like its been DER encoded and then hex encoded.
> >
> >
> >
> The private key is saved in asn.1 format as per the RSA PKCS
> descriptions. The format contains an "object" that identifies it as an
> RSA key. The actual RSA is encoded as an OCTET STRING, which is itself
> a BER sequence of the numerical values that make up the key. They are
> described, I believe, as BER encodings, but are generated as conforming
> to DER.
>
--
James Vanns BSc (Hons) MCP
Linux Systems Administrator
Software Engineer (Linux / C & C++)
Canterbury Christ Church University College
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370