On Thursday, December 5, 2013 5:23:27 AM UTC-5, Nick de Smith wrote: > > On Thursday, 5 December 2013 07:50:10 UTC, Jeffrey Walton wrote: >> >> >> I believe most of your questions can be answered with >> http://www.cryptopp.com/wiki/Keys_and_Formats. >> >> Crypto++ does not read or write PEM encoded keys (i.e., --- BEGIN RSA >> PRIVATE KEY --- and friends). It only reads and writes ASN.1's DER/BER. >> > > The Crypto++ help files/WIki are, by most people's standards, incomplete > and often confusing > Contributions are welcomed ;)
> ... however the reference you give above (which I read some time ago) does > not anser or even clarify the issue I asked about... > I suspect part of the reason you are having trouble is because you don't know what's being saved (or loaded). For example, a Public Key versus a subjectPublicKeyInfo. > I'm well aware of the RFC 142x headers in PEM files - I have written > (modified) a pipeline filter derived form Unflushable<Filter> such that I > can simply load and base64-decode a PEM file with: > > ByteQueue data; > > > > FileSource PEMfile( filename.c_str(), true, new PEMStripper( new > Base64Decoder() ) ); > > > > PEMfile.TransferTo( data ); > > data.MessageEnd(); > > > If you read my question, its not about PEM file formats per se, > Ah, my bad. You keep mentioning them as if they have significance. > its about the assymetry in having to use > DEREncodePrivateKey/BERDecodePrivateKey (note the BER/DER difference) for > the private key and the further inconsistency between how a private key is > saved/restored and in reading/writing public keys. > I don't believe its inconsistent. I think its very consistent across nearly all (all?) key types. The trick is you have to know what is being saved (or loaded). This may help you understand the differences in BER and DER encoding. Its the ITU's standard: http://www.itu.int/rec/T-REC-X.690-200811-I/en. Hint: Its in spirit with Postel's Law. Jeff -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
