[xmlsec] extraction of DSA key value from XML?

J. Patrick Bedell jpbedell at gmail.com
Fri Oct 7 15:29:05 PDT 2005


Hi!
   Thanks for all your work on XMLSec!  I'm trying to extract a DSA
public key from externally input data, but I'm not having too much
success.  I'm trying to parse the key

char * key_value_str =
"<ds:KeyValue xmlns:ds='http://www.w3.org/2000/09/xmldsig#'>
<ds:DSAKeyValue>
<ds:P>/X9TgR11EilS30qcLuzk5/YRt1I870QAwx4/gLZRJmlFXUAiUftZPY1Y+r/F
9bow9subVWzXgTuAHTRv8mZgt2uZUKWkn5/oBHsQIsJPu6nX/rfGG/g7V+fG
qKYVDwT7g/bTxR7DAjVUE1oWkTL2dfOuK2HXKu/yIgMZndFIAcc=</ds:P>
<ds:Q>l2BQjxUjC8yykrmCouuEC/BYHPU=</ds:Q>
<ds:G>9+GghdabPd7LvKtcNrhXuXmUr7v6OuqC+VdMCz0HgmdRWVeOutRZT+Z
xBxCBgLRJFnEj6EwoFhO3zwkyjMim4TwWeotUfI0o4KOuHiuzpnWRbqN/C/oh
NWLx+2J6ASQ7zKTxvqhRkImog9/hWuWfBpKLZl6Ae1UlZAFMO/7PSSo=</ds:G>
<ds:Y>nbnmFi2rWlqgvcV1uyYLf5a+kLEh+f6z7W2mUupoYvXs215txf78P8zRw
vq71i5Z3XeR37bimq3FusP8W7eOrSQw7DmbMYJcIBNLE1UHLczPzXhxVjuLhsz9
Mp8LaJTYJhzuh1osRtvQBDy/t7mrKTzw+vJpsRf3M7/9eW1M01A=</ds:Y>
</ds:DSAKeyValue>
</ds:KeyValue>";

using the code

 xmlSecKeysMngrPtr mngr = xmlSecKeysMngrCreate();

  xmlSecCryptoAppDefaultKeysMngrInit(mngr);

  xmlSecKeyInfoCtxPtr infoCtx = xmlSecKeyInfoCtxCreate(mngr);
  xmlSecKeyInfoCtxInitialize(infoCtx, mngr);

  xmlSecKeyPtr key;

  xmlDocPtr docTwo = xmlParseDoc((xmlChar*)key_value_str);

  xmlNodePtr root_node = xmlDocGetRootElement(docTwo);

  xmlSecKeyDataXmlRead( xmlSecKeyDataDsaGetKlass(), key,root_node, infoCtx );

   However, when I use this code, I get the error

func=xmlSecOpenSSLKeyDataDsaXmlRead:file=evp.c:line=553:obj=dsa:subj=unknown:error=41:invalid
key data:

   Can you help?

   Thanks!

   Patrick



More information about the xmlsec mailing list