Title: encryption example (xmlsec.exe)

        I'm trying to encrypt anything using xmlsec.exe and I fail. I don't know how to specify command line parameters. When I try this:

xmlsec --encrypt --pubkey-cert-der "my.cer" --node-name "firstname" --xml-data "sample.xml" "enc_tmpl.xml"

        I got this error:

func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj=xmlSecKeysMngrFindKey:error=1:xmlsec library function failed:

func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unknown:subj=unknown:error=45:key is not found:
func=xmlSecEncCtxXmlEncrypt:file=..\src\xmlenc.c:line=375:obj=unknown:subj=xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed:

Error: failed to encrypt xml file "sample.xml"
Error: failed to encrypt file with template "enc_tmpl.xml"

        What does it mean? It seems that it can't find a key to use for encryption. What did I wrong? Are there examples how to encrypt and decrypt (XML and binary) files using xmlsec.exe?

        Similar thing happen when I try to use other templates:

xmlsec --encrypt --pubkey-cert-der "my.cer" --node-name "firstname" --xml-data "sample.xml" "enc_tmpl_cert.xml"

        Error message:

func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj=xmlSecKeysMngrFindKey:error=1:xmlsec library function failed:

func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unknown:subj=unknown:error=45:key is not found:
func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unknown:subj=xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed:

func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj=xmlSecKeysMngrFindKey:error=1:xmlsec library function failed:

func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unknown:subj=unknown:error=45:key is not found:
func=xmlSecEncCtxXmlEncrypt:file=..\src\xmlenc.c:line=375:obj=unknown:subj=xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed:

Error: failed to encrypt xml file "sample.xml"
Error: failed to encrypt file with template "enc_tmpl_cert.xml"

        I'm attaching certificates, source XML (sample.xml) and three template files.

Thank you,
Milan <<...>> <<...>> <<...>> <<...>> <<...>> <<...>>

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
	<to><firstname>Tove</firstname><lastname>Rich</lastname></to>
	<from>Jani</from>
	<heading>Reminder</heading>
	<body>Don't forget me this weekend!</body>
</note>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><note>
	<to><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"; Type="http://www.w3.org/2001/04/xmlenc#Element";>
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#";>
<xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#";>
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
<xenc:CipherData>
<xenc:CipherValue></xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedKey>
</ds:KeyInfo>
<xenc:CipherData>
<xenc:CipherValue></xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData><lastname>Rich</lastname></to>
	<from>Jani</from>
	<heading>Reminder</heading>
	<body>Don't forget me this weekend!</body>
</note>
<?xml version="1.0"?>
<EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#";>
    <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
    <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#";>
	<KeyName/>
    </KeyInfo>   
    <CipherData>
	<CipherValue></CipherValue>
    </CipherData>
</EncryptedData>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"; Type="http://www.w3.org/2001/04/xmlenc#Element";>
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#";>
<xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#";>
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
<xenc:CipherData>
<xenc:CipherValue></xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedKey>
</ds:KeyInfo>
<xenc:CipherData>
<xenc:CipherValue></xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData>

Attachment: my.cer
Description: application/x509-ca-cert


Attachment: my_ca.cer
Description: application/x509-ca-cert

_______________________________________________
xmlsec mailing list
[EMAIL PROTECTED]
http://www.aleksey.com/mailman/listinfo/xmlsec

Reply via email to