On Tue, Nov 25, 2014, Philip Prindeville via RT wrote:

> 
> On 11/25/2014 07:48 AM, Matt Caswell via RT wrote:
> > On Thu Nov 20 21:35:45 2014, phil...@redfish-solutions.com wrote:
> >> Can the following function please be added:
> >>
> >> int RSA_public_digest(const RSA* key, const EVP_MD *type, unsigned
> >> char *md, unsigned int *len);
> >>
> >> which would use ???type??? to generate a digest over the DER encoding of
> >> the public portion of ???key???, and deposit ???len??? bytes into the
> >> buffer starting at ???md???.
> >>
> >> A similar function:
> >>
> >> int RSA_private_digest() would take the same parameters as
> >> RSA_public_digest(), but for the DER encoding of the private key.
> >> This function is less useful than the first, but is useful for
> >> symmetry in the API and some corner cases.
> > This could be done quite simply using i2d_RSA_PUBKEY (or i2d_RSAPublicKey
> > depending on what flavour of public key you want) and then using the
> > EVP_Digest* functions.
> >
> > Closing this ticket.
> >
> > Matt
> >
> 
> Okay, but why not include a convenience wrapper to do it, whether it's 
> easy or not?
> 
> It seems to be a frequent construct.
> 

I'm curious: I've not seen the private key version before, where is it used?

You can actually perform the encode and digest operation all in one go using
the ASN1_item_digest function. Something like this should work:

rv = ASN1_item_digest(ASN1_ITEM_rptr(RSAPublicKey), mdtype, rsa,
                                                                        md, 
&mdlen);

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to