0

From pkcs12 file, I extracted the private key and cert using the following - PKCS12_parse(p12, argv[2], &privatekey, &cert, &ca);

Now, I need to use the privatekey and cert to sign an XML using xmlsec libraries.

However, xmlSecCryptoAppKeyLoad() expects the key in const char* format.

How do I do the conversion?

Or, can I use xmlSecCryptoAppKeyLoadMemory() and privatekey without having to do the conversion?

skaffman
  • 398,947
  • 96
  • 818
  • 769
user162916
  • 61
  • 2
  • 9

1 Answers1

1

If you use the XMLSEC-OpenSSL interface, the xmlSecOpenSSLEvpKeyAdopt() function loads an xmlsec key object from an OpenSSL EVP_PKEY *, and xmlSecOpenSSLKeyDataX509AdoptKeyCert() loads an OpenSSL X509 certificate.

caf
  • 233,326
  • 40
  • 323
  • 462