[botan-devel] store public key in aplication and use to verify signed file

strenzke strenzke at flexsecure.de
Tue Jan 10 12:14:41 EST 2012


Hi,


you may not call get() on the auto_ptr to get the plain pointer in this
situation: this means that the auto_ptr will keep ownership of the raw pointer,
and once the auto_ptr is destructed - which may be anytime after its last usage
in that scope - the plain pointer points to the remains of the destructed
object.


Thus the right way to do this would be to call release() on the auto_ptr, or
keep the object in the auto_ptr which gives has the advantage that you don't
have to worry about resource leaks.


Regards,
Falko




botan-devel-request at randombit.net hat am 10. Januar 2012 um 18:02 geschrieben:

> Send botan-devel mailing list submissions to
>         botan-devel at randombit.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.randombit.net/mailman/listinfo/botan-devel
> or, via email, send a message with subject or body 'help' to
>         botan-devel-request at randombit.net
>
> You can reach the person managing the list at
>         botan-devel-owner at randombit.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of botan-devel digest..."
>
>
> Today's Topics:
>
>    1. store public key in aplication and use to verify        signed file
>       (Radiceski, Darko)
>    2. Re: store public key in aplication and use to verify signed
>       file (Jack Lloyd)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 10 Jan 2012 17:06:06 +1100
> From: "Radiceski, Darko" <D.Radiceski at aamgroup.com>
> To: <botan-devel at randombit.net>
> Subject: [botan-devel] store public key in aplication and use to
>         verify        signed file
> Message-ID:
>         <74066E80282C2746A409BF1B2F7ACE65010CEDEC at wolmail.aamhatch.com.au>
> Content-Type: text/plain; charset="us-ascii"
>
> Dear all,
> 
> I was wondering if it is possible to store the public key in my
> application and then get:
> 
>       std::auto_ptr<X509_PublicKey> key(X509::load_key(argv[1]));
>       DSA_PublicKey* dsakey = dynamic_cast<DSA_PublicKey*>(key.get());
> 
> to use the string value rather then reading from a file.
> 
> Sincerely
> Dan
>
> Attention
>
> Email Disclaimer Notice - This message is the property of AAM Pty Ltd. The
> information in this email is confidential and may be legally privileged.
> It is intended solely for the
> addressee. Access to this email by anyone else is unauthorised. If you are not
> the intended recipient, any disclosure, copying, distribution or any action
> taken or omitted to be taken in reliance on it is prohibited and may be
> unlawful.
>
> If you have received this message in error please notify AAM Pty Ltd.
> immediately via email to mailadmin at aamgroup.com
> <mailto:mailadmin at aamgroup.com>
>
> This email has been scanned and cleared by NetIQ Mail Marshal, however AAM Pty
> Ltd does not guarantee this message free of viruses, or interference.
> ________________________________
> -------------- next part --------------
> HTML attachment scrubbed and removed
>
> ------------------------------
>
> Message: 2
> Date: Tue, 10 Jan 2012 10:32:51 -0500
> From: Jack Lloyd <lloyd at randombit.net>
> To: Botan development list <botan-devel at randombit.net>
> Subject: Re: [botan-devel] store public key in aplication and use to
>         verify signed file
> Message-ID: <20120110153251.GJ28036 at randombit.net>
> Content-Type: text/plain; charset=us-ascii
>
> On Tue, Jan 10, 2012 at 05:06:06PM +1100, Radiceski, Darko wrote:
> > Dear all,
>> > I was wondering if it is possible to store the public key in my
> > application and then get:
>> >       std::auto_ptr<X509_PublicKey> key(X509::load_key(argv[1]));
> >       DSA_PublicKey* dsakey = dynamic_cast<DSA_PublicKey*>(key.get());
>> > to use the string value rather then reading from a file.
>
> It's a bit verbose, but
>
>   std::string my_key_string = ...
>   DataSource_Memory src(my_key_string);
>   std::auto_ptr<X509_PublicKey> key(X509::load_key(src));
>   DSA_PublicKey* dsakey = dynamic_cast<DSA_PublicKey*>(key.get());
>
>
>
> ------------------------------
>
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel
>
>
> End of botan-devel Digest, Vol 84, Issue 1
> ******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20120110/8394d389/attachment.html>


More information about the botan-devel mailing list