On Wed, 13 May 1998, Brendan Quinn wrote:
> > > is it possible to convert PEM to BER with SSLeay ? With other product ?
> > Not without breaking the signature.  What SSLeay calls "PEM" format (which
> > it uses for many more object types than PEM defines) is just a base64 encoding
...
> But isn't DER a valid subset of BER? So converting to DER should be
> fine for most purposes, right?

If you just want to remove the base64 encoding
ssleay base64 -d -in infile -out outfile (add a -v to show the byte counts)
This will choke sometimes on header lines, since it 'parses' until a suitable
base64 like line is encountered.

As for the DER vs BER.  Normally signatures are generated on the DER encoding
of the ASN.1 or on the contents of the BER/DER encoding.  For certifcates,
the part that is signed must be DER encoded, but the actual
cert_info, algorithm and signature triple can be BER encoded.

For PKCS7, the data is often BER encoded, but the signature is specified as
the content bytes of the component OCTET Strings.

Anyway, I hopefully the question was how to conver from binary to base64.
ssleay base64 -in infile -out outfile
will base64 encode the input file.  The base64 command is acutally just using
the base64 BIO.  It base64 decodes on read and base64 encodes on write.
The code doing this is found in apps/enc.c  The enc program will
encrypt/decrypt with or without base64 encoding/decoding with any of the
ciphers built into SSLeay.
ssleay enc -help
will give details.

eric

+-------------------------------------------------------------------------+
| Administrative requests should be sent to [EMAIL PROTECTED] |
| List service provided by Open Software Associates, http://www.osa.com/  |
+-------------------------------------------------------------------------+

Reply via email to