Skip Menu |

This queue is for tickets about the Crypt-OpenSSL-PKCS10 CPAN distribution.

Report information
The Basics
Id: 111829
Status: new
Priority: 0/
Queue: Crypt-OpenSSL-PKCS10

People
Owner: Nobody in particular
Requestors: JBERGER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Building a PKCS10 object from an RSA destroys the RSA object
as seen here if I build the PKCS10 object and then later try to dump the key as a string, I get no content. perl -Maliased=Crypt::OpenSSL::RSA -Maliased=Crypt::OpenSSL::PKCS10 -E 'my $rsa = RSA->generate_key(4096); PKCS10->new_from_rsa($rsa); say $rsa->get_private_key_string' Without generating the PKCS10 object (or alternatively, by "cloning" the RSA object) I can print the key just fine. This is a surprising result and IMO should be fixed.
On Sat Feb 06 12:17:43 2016, JBERGER wrote: Show quoted text
> as seen here if I build the PKCS10 object and then later try to dump > the key as a string, I get no content. > > perl -Maliased=Crypt::OpenSSL::RSA -Maliased=Crypt::OpenSSL::PKCS10 -E > 'my $rsa = RSA->generate_key(4096); PKCS10->new_from_rsa($rsa); say > $rsa->get_private_key_string' > > Without generating the PKCS10 object (or alternatively, by "cloning" > the RSA object) I can print the key just fine. > > This is a surprising result and IMO should be fixed.
I've tracked it down further, it seems to be the DESTROY method because if I do this the string is correct: perl -Maliased=Crypt::OpenSSL::RSA -Maliased=Crypt::OpenSSL::PKCS10 -E 'my $rsa = RSA->generate_key(4096); my $pkcs = PKCS10->new_from_rsa($rsa); say $rsa->get_private_key_string' the difference being the PKCS10 object isn't cleaned up until after printing the string
On Sat Feb 06 13:02:05 2016, JBERGER wrote: Show quoted text
> On Sat Feb 06 12:17:43 2016, JBERGER wrote:
> > as seen here if I build the PKCS10 object and then later try to dump > > the key as a string, I get no content. > > > > perl -Maliased=Crypt::OpenSSL::RSA -Maliased=Crypt::OpenSSL::PKCS10 > > -E > > 'my $rsa = RSA->generate_key(4096); PKCS10->new_from_rsa($rsa); say > > $rsa->get_private_key_string' > > > > Without generating the PKCS10 object (or alternatively, by "cloning" > > the RSA object) I can print the key just fine. > > > > This is a surprising result and IMO should be fixed.
> > I've tracked it down further, it seems to be the DESTROY method > because if I do this the string is correct: > > perl -Maliased=Crypt::OpenSSL::RSA -Maliased=Crypt::OpenSSL::PKCS10 -E > 'my $rsa = RSA->generate_key(4096); my $pkcs = PKCS10-
> >new_from_rsa($rsa); say $rsa->get_private_key_string'
> > the difference being the PKCS10 object isn't cleaned up until after > printing the string
And indeed my original one-liner works if I comment out these two lines, though I don't suppose that that is a valid solution but at least its another datapoint. https://metacpan.org/source/JONOZZZ/Crypt-OpenSSL-PKCS10-0.15/PKCS10.xs#L365-366