[botan-devel] botan-devel Digest, Vol 84, Issue 2

Radiceski, Darko D.Radiceski at aamgroup.com
Tue Jan 24 01:30:47 EST 2012


I have tried the following code:


	    std::string my_key_string = "-----BEGIN PUBLIC KEY-----\n"
	
"MIIBIjANBgkqh1234w0BAQEFAAOCAQ8AMIIBCgKCAQEAp7EZiF/D6MluBqTaCLqM\n"
	
"97Kg+DNvwHBRkjc+MuDTYng8BfzkD4vhm5AK1qVIBUsZkvpwealAVBawsr201n6V\n"
	
"5d7IlrtJAIE0YXvS0bqiizUgeURiAR9YrFR6zTfu/eaARMPU1yFJLAkw+hGkC3ta\n"
	
"A3SjcYIWfWeR4bO6H2SHMjA1234RBeaeR3J08fEsvv2grZCxYeAuxSzwv0xNgNim\n"
	
"4n/3Uf4nC3Zs2MQVj0NX96WuVtmcwI2LXoZctXn0aLEu58BBU2LagAVANP2SPzZ6\n"
	
"ov9fw8b7DfSMf55JQgptKp0s1234j0xeIp4fGLbSQbcqmD5hshhz5cGARXgkZabc\n"
	
"yQIDAQAB\n"
	
"-----END PUBLIC KEY-----\n";

		  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()); 

However when I got and check if I have a valid public key:

      if(!dsakey)
         {
         std::cout << "The loaded key is not a DSA key!\n";
         return 1;
         }

I get that this I not valid. 

I am doing anything onviously wrong?

Cheers
Dan
-----Original Message-----
From: botan-devel-bounces at randombit.net
[mailto:botan-devel-bounces at randombit.net] On Behalf Of
botan-devel-request at randombit.net
Sent: Thursday, 12 January 2012 4:01 AM
To: botan-devel at randombit.net
Subject: botan-devel Digest, Vol 84, Issue 2

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. Re: store public key in aplication and use to verify	signed
      file (strenzke)


----------------------------------------------------------------------

Message: 1
Date: Tue, 10 Jan 2012 18:14:41 +0100 (CET)
From: strenzke <strenzke at flexsecure.de>
To: botan-devel at randombit.net
Subject: Re: [botan-devel] store public key in aplication and use to
	verify	signed file
Message-ID:
	
<868895284.514788.1326215682100.JavaMail.open-xchange at email.1und1.de
Content-Type: text/plain; charset="utf-8"

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 --------------
HTML attachment scrubbed and removed

------------------------------

_______________________________________________
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 2
******************************************
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. 
________________________________



More information about the botan-devel mailing list