[xmlsec] using public key without loading from file
Bernd Becker
bb at bernd-becker.de
Thu May 26 02:18:07 PDT 2005
You may want to look at xmlSecCryptoAppKeyLoadMemory(), e.g.
dsigCtx->signKey =
xmlSecCryptoAppKeyLoadMemory(pubkey, strlen(pubkey),
xmlSecKeyDataFormatPem, NULL, NULL, NULL);
assuming you have your key in
char *pubkey =
"-----BEGIN PUBLIC KEY-----\n\
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMYkh5vHrw5uBp4BFZgyLKnbko\n\
qfQqiZuOfUdwTfg+i5J9rPpkEiX3TDIkLiDqV+GTbgOjip2psKMNkcQmdHZhUcVd\n\
qRZIxAe3EEqEHDh1gk+Pw565zfyLs7s02InN6NAm7YmzVczPe/84TI0ZDfm6b5Al\n\
0wLFXTLqm+QAYsG/BQIDAQAB\n\
-----END PUBLIC KEY-----";
Bernd
--On Thursday, May 26, 2005 16:18:32 +1200 Simon Meiklejohn
<Simon.Meiklejohn at perform-sol.com> wrote:
>
> I'm wanting to write a program to validate signed xml (signed using an
> RSA/openSSL private key) using a public key linked to my application.
> I've been looking at
>
> xmlSecKeyDataBinRead ()
> is this the appropriate function for the task, to convert by raw key to
> xmlSecKeyPtr?
>
> Using openssl to create the private and public keys i have the following
>
> -----BEGIN PUBLIC KEY-----
> MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMYkh5vHrw5uBp4BFZgyLKnbko
> qfQqiZuOfUdwTfg+i5J9rPpkEiX3TDIkLiDqV+GTbgOjip2psKMNkcQmdHZhUcVd
> qRZIxAe3EEqEHDh1gk+Pw565zfyLs7s02InN6NAm7YmzVczPe/84TI0ZDfm6b5Al
> 0wLFXTLqm+QAYsG/BQIDAQAB
> -----END PUBLIC KEY-----
>
> Should this be the contents of the const xmlSecByte* buf parameter, or
> more of a binary format?
> Strip the ---Begin.... ... End----- stuff out or leave it in?
>
> Cheers
>
> Simon
More information about the xmlsec
mailing list