Re: [xmlsec] encryption works but decryption failed
EncryptionMethod Algorithm=http://www.w3.org/2001/04/xmlenc#aes192-cbc; / and you are using public key... Aleksey Balakrishnan Viswanathan wrote: Aleksey I took the template http://svn.gnome.org/viewvc/xmlsec/trunk/tests/aleksey-xmlenc-01/enc-des 3cbc-aes192-keyname.tmpl?view=markup and this time even encrypt failed with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key aes-192 --pubkey-pem:test-aes192 leafkeypub.pem --outp ut testenc.xml templatefromaleksey.xml func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxUriEncrypt:file=..\src\xmlenc.c:line=527:obj=unknown:su bj=xmlSe cEncCtxEncDataNodeRead:error=1:xmlsec library function failed: Error: failed to encrypt file test.xml Error: failed to encrypt file with template templatefromaleksey.xml -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 11:38 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Oh, never mine. I got it. You specify session key and in this case you *must* add EncryptedKey to the template to actually store the session key. Checkout examples in xmlsec/tests/aleksey-xmlenc-01 Aleksey Balakrishnan Viswanathan wrote: Aleksey, I tried that already and same result, commands below:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 11:30 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Could you please to try to remove the KeyName and do *not* specify key name in the command line? Aleksey Balakrishnan Viswanathan wrote: Aleksey, Thanks for your quick response. I tried removing the KeyName/ from the template and also specified the KeyName for encrypt and decrypt, but decrypt still fails with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem:leaf-key leafkeypub.pem --output testenc.xml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em:leaf-key leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml I am attaching the template and encrypted document. Thanks. -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 10:37 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Most likely the cause of the problem is empty KeyName node. Try to remove it from the template or specify key name in the command line options for both encryption and decryption. Aleksey Balakrishnan Viswanathan wrote: Hi All, I am a newbie to xmlsec and also to security in general. I am trying to use xmlsec utility to encrypt and decrypt using the windows binary provided by Igor. I am able to successfully encrypt a xml file using syntax Encryption:- C:\xmlsecutility\libxmlsec-1.2.10
RE: [xmlsec] encryption works but decryption failed
Aleksey, I tried that already and same result, commands below:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 11:30 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Could you please to try to remove the KeyName and do *not* specify key name in the command line? Aleksey Balakrishnan Viswanathan wrote: Aleksey, Thanks for your quick response. I tried removing the KeyName/ from the template and also specified the KeyName for encrypt and decrypt, but decrypt still fails with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem:leaf-key leafkeypub.pem --output testenc.xml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em:leaf-key leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml I am attaching the template and encrypted document. Thanks. -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 10:37 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Most likely the cause of the problem is empty KeyName node. Try to remove it from the template or specify key name in the command line options for both encryption and decryption. Aleksey Balakrishnan Viswanathan wrote: Hi All, I am a newbie to xmlsec and also to security in general. I am trying to use xmlsec utility to encrypt and decrypt using the windows binary provided by Igor. I am able to successfully encrypt a xml file using syntax Encryption:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2.xml the above works and I can see the encrypted data in ciphervalue node of the output document testenc.xml (also attached). However, when I try the reverse, i.e, decrypting the document from above step I get error below Decryption fails:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml The error says key not found, but key is in the same folder where I am running it from. I am also attaching the private key
RE: [xmlsec] encryption works but decryption failed
Aleksey, Thanks for your quick response. I tried removing the KeyName/ from the template and also specified the KeyName for encrypt and decrypt, but decrypt still fails with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem:leaf-key leafkeypub.pem --output testenc.xml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em:leaf-key leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml I am attaching the template and encrypted document. Thanks. -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 10:37 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Most likely the cause of the problem is empty KeyName node. Try to remove it from the template or specify key name in the command line options for both encryption and decryption. Aleksey Balakrishnan Viswanathan wrote: Hi All, I am a newbie to xmlsec and also to security in general. I am trying to use xmlsec utility to encrypt and decrypt using the windows binary provided by Igor. I am able to successfully encrypt a xml file using syntax Encryption:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2.xml the above works and I can see the encrypted data in ciphervalue node of the output document testenc.xml (also attached). However, when I try the reverse, i.e, decrypting the document from above step I get error below Decryption fails:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml The error says key not found, but key is in the same folder where I am running it from. I am also attaching the private key (password - leaf) and public key that corresponds to it I am attaching all the relevant files. Any pointers are appreciated. Thanks. -Bala ___ xmlsec mailing list xmlsec@aleksey.com http://www.aleksey.com/mailman/listinfo/xmlsec ?xml version=1.0? !-- XML Security Library example: Simple encryption template file for encrypt1 example. -- 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#; /KeyInfo CipherData CipherValuez7KUZeM4wNhByVE5iYfYT30uZAdYh/YbfIclJssJPtr0jmAQESeM+D3QbhEhmHkL Ms1cCVUAOJI9Kl1EA1kHgub5AGhjPMp5tF+dLfUJmcfax8eSjX1RuUo77o6J/oMY BuUCroXzJ3Gs0d1hJzpu+MT3AX8mdOYApOH2VfPXJV8Mej6EZfrgXGKVGJJA8HMG puxCmg9ufejIW9yeDcjUiB7xGZTjgWpC/CipherValue /CipherData /EncryptedData ?xml version=1.0? !-- XML Security Library example: Simple encryption template file for encrypt1 example. -- 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#; /KeyInfo CipherData CipherValue/CipherValue /CipherData /EncryptedData___ xmlsec mailing list xmlsec@aleksey.com http://www.aleksey.com/mailman/listinfo/xmlsec
[xmlsec] encryption works but decryption failed
Hi All, I am a newbie to xmlsec and also to security in general. I am trying to use xmlsec utility to encrypt and decrypt using the windows binary provided by Igor. I am able to successfully encrypt a xml file using syntax Encryption:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2.xml the above works and I can see the encrypted data in ciphervalue node of the output document testenc.xml (also attached). However, when I try the reverse, i.e, decrypting the document from above step I get error below Decryption fails:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml The error says key not found, but key is in the same folder where I am running it from. I am also attaching the private key (password - leaf) and public key that corresponds to it I am attaching all the relevant files. Any pointers are appreciated. Thanks. -Bala leafkey.pem Description: leafkey.pem leafkeypub.pem Description: leafkeypub.pem ?xml version=1.0 encoding=UTF-8? Person Nameabc/Name Addressabc street/Address CityPalo Alto/City Zip94304/Zip /Person?xml version=1.0? !-- XML Security Library example: Simple encryption template file for encrypt1 example. -- 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 CipherValueL3czkfkL77hl66mze00l2w77ovyqgaH4M3gocoeNIISybhJsDB6SFroPFJzpYrvl OeZYCAOm/Ns/shTOSFx3aQsX2+nmF9IY1tRjaBo7/jfeEnSi49jdTxoX28QWdYOG YXRakKHd4ZQFvUJaAW2OmBu3AIyiljaTE2jbo2vW/yeG/zO3MC6d2/VMGh/TCR+t ELBXYCjyhGnzaUf9LC/wcLFV2RCxgjgB/CipherValue /CipherData /EncryptedData ___ xmlsec mailing list xmlsec@aleksey.com http://www.aleksey.com/mailman/listinfo/xmlsec
Re: [xmlsec] encryption works but decryption failed
Well, your public key can not be used for AES192 encryption requested by the template. Aleksey Balakrishnan Viswanathan wrote: Aleksey, Sorry for being a bit dense. This node is already in the template and yes I am using pub key?. -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 12:04 PM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed EncryptionMethod Algorithm=http://www.w3.org/2001/04/xmlenc#aes192-cbc; / and you are using public key... Aleksey Balakrishnan Viswanathan wrote: Aleksey I took the template http://svn.gnome.org/viewvc/xmlsec/trunk/tests/aleksey-xmlenc-01/enc-des 3cbc-aes192-keyname.tmpl?view=markup and this time even encrypt failed with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key aes-192 --pubkey-pem:test-aes192 leafkeypub.pem --outp ut testenc.xml templatefromaleksey.xml func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxUriEncrypt:file=..\src\xmlenc.c:line=527:obj=unknown:su bj=xmlSe cEncCtxEncDataNodeRead:error=1:xmlsec library function failed: Error: failed to encrypt file test.xml Error: failed to encrypt file with template templatefromaleksey.xml -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 11:38 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Oh, never mine. I got it. You specify session key and in this case you *must* add EncryptedKey to the template to actually store the session key. Checkout examples in xmlsec/tests/aleksey-xmlenc-01 Aleksey Balakrishnan Viswanathan wrote: Aleksey, I tried that already and same result, commands below:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 11:30 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Could you please to try to remove the KeyName and do *not* specify key name in the command line? Aleksey Balakrishnan Viswanathan wrote: Aleksey, Thanks for your quick response. I tried removing the KeyName/ from the template and also specified the KeyName for encrypt and decrypt, but decrypt still fails with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem:leaf-key leafkeypub.pem --output testenc.xml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em:leaf-key leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml I am attaching the template and encrypted document. Thanks. -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 10:37 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Most likely the cause
RE: [xmlsec] encryption works but decryption failed
Aleksey, Thanks again. I fear that I am taking too much of your time just trying to understand the basics of this tool. Basically, what I am trying to accomplish as part of learning this tool is to encrypt and decrypt a simple xml file and running into problems with templates, switches etc. Is there a place or document where I can find a template, a set of keys, syntax for encrypt/decrypt that work out-of-the-box, the reason being such canned examples will help novices like me. -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 1:23 PM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Well, your public key can not be used for AES192 encryption requested by the template. Aleksey Balakrishnan Viswanathan wrote: Aleksey, Sorry for being a bit dense. This node is already in the template and yes I am using pub key?. -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 12:04 PM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed EncryptionMethod Algorithm=http://www.w3.org/2001/04/xmlenc#aes192-cbc; / and you are using public key... Aleksey Balakrishnan Viswanathan wrote: Aleksey I took the template http://svn.gnome.org/viewvc/xmlsec/trunk/tests/aleksey-xmlenc-01/enc-des 3cbc-aes192-keyname.tmpl?view=markup and this time even encrypt failed with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key aes-192 --pubkey-pem:test-aes192 leafkeypub.pem --outp ut testenc.xml templatefromaleksey.xml func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxUriEncrypt:file=..\src\xmlenc.c:line=527:obj=unknown:su bj=xmlSe cEncCtxEncDataNodeRead:error=1:xmlsec library function failed: Error: failed to encrypt file test.xml Error: failed to encrypt file with template templatefromaleksey.xml -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 11:38 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Oh, never mine. I got it. You specify session key and in this case you *must* add EncryptedKey to the template to actually store the session key. Checkout examples in xmlsec/tests/aleksey-xmlenc-01 Aleksey Balakrishnan Viswanathan wrote: Aleksey, I tried that already and same result, commands below:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 11:30 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Could you please to try to remove the KeyName and do *not* specify key name in the command line? Aleksey Balakrishnan Viswanathan wrote: Aleksey, Thanks for your quick response. I tried removing the KeyName/ from the template and also specified the KeyName for encrypt and decrypt, but decrypt still fails with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem:leaf-key leafkeypub.pem --output testenc.xml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em:leaf-key leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func
Re: [xmlsec] encryption works but decryption failed
Oh, never mine. I got it. You specify session key and in this case you *must* add EncryptedKey to the template to actually store the session key. Checkout examples in xmlsec/tests/aleksey-xmlenc-01 Aleksey Balakrishnan Viswanathan wrote: Aleksey, I tried that already and same result, commands below:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 11:30 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Could you please to try to remove the KeyName and do *not* specify key name in the command line? Aleksey Balakrishnan Viswanathan wrote: Aleksey, Thanks for your quick response. I tried removing the KeyName/ from the template and also specified the KeyName for encrypt and decrypt, but decrypt still fails with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem:leaf-key leafkeypub.pem --output testenc.xml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em:leaf-key leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml I am attaching the template and encrypted document. Thanks. -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 10:37 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Most likely the cause of the problem is empty KeyName node. Try to remove it from the template or specify key name in the command line options for both encryption and decryption. Aleksey Balakrishnan Viswanathan wrote: Hi All, I am a newbie to xmlsec and also to security in general. I am trying to use xmlsec utility to encrypt and decrypt using the windows binary provided by Igor. I am able to successfully encrypt a xml file using syntax Encryption:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2.xml the above works and I can see the encrypted data in ciphervalue node of the output document testenc.xml (also attached). However, when I try the reverse, i.e, decrypting the document from above step I get error below Decryption fails:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt
Re: [xmlsec] encryption works but decryption failed
Could you please to try to remove the KeyName and do *not* specify key name in the command line? Aleksey Balakrishnan Viswanathan wrote: Aleksey, Thanks for your quick response. I tried removing the KeyName/ from the template and also specified the KeyName for encrypt and decrypt, but decrypt still fails with key not found error C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem:leaf-key leafkeypub.pem --output testenc.xml template2withoutKeyName.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplenotepad testenc.xml C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em:leaf-key leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml I am attaching the template and encrypted document. Thanks. -Bala -Original Message- From: Aleksey Sanin [mailto:[EMAIL PROTECTED] Sent: Friday, January 18, 2008 10:37 AM To: Balakrishnan Viswanathan Cc: xmlsec@aleksey.com Subject: Re: [xmlsec] encryption works but decryption failed Most likely the cause of the problem is empty KeyName node. Try to remove it from the template or specify key name in the command line options for both encryption and decryption. Aleksey Balakrishnan Viswanathan wrote: Hi All, I am a newbie to xmlsec and also to security in general. I am trying to use xmlsec utility to encrypt and decrypt using the windows binary provided by Igor. I am able to successfully encrypt a xml file using syntax Encryption:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2.xml the above works and I can see the encrypted data in ciphervalue node of the output document testenc.xml (also attached). However, when I try the reverse, i.e, decrypting the document from above step I get error below Decryption fails:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj= xmlSecKe ysMngrFindKey:error=1:xmlsec library function failed: func=xmlSecEncCtxEncDataNodeRead:file=..\src\xmlenc.c:line=885:obj=unkno wn:subj= unknown:error=45:key is not found: func=xmlSecEncCtxDecryptToBuffer:file=..\src\xmlenc.c:line=643:obj=unkno wn:subj= xmlSecEncCtxEncDataNodeRead:error=1:xmlsec library function failed: func=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj= xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml The error says key not found, but key is in the same folder where I am running it from. I am also attaching the private key (password - leaf) and public key that corresponds to it I am attaching all the relevant files. Any pointers are appreciated. Thanks. -Bala ___ xmlsec mailing list xmlsec@aleksey.com http://www.aleksey.com/mailman/listinfo/xmlsec ___ xmlsec mailing list xmlsec@aleksey.com http://www.aleksey.com/mailman/listinfo/xmlsec ___ xmlsec mailing list xmlsec@aleksey.com http://www.aleksey.com/mailman/listinfo/xmlsec
Re: [xmlsec] encryption works but decryption failed
Most likely the cause of the problem is empty KeyName node. Try to remove it from the template or specify key name in the command line options for both encryption and decryption. Aleksey Balakrishnan Viswanathan wrote: Hi All, I am a newbie to xmlsec and also to security in general. I am trying to use xmlsec utility to encrypt and decrypt using the windows binary provided by Igor. I am able to successfully encrypt a xml file using syntax Encryption:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --encrypt --binary-da ta test.xml --session-key des-192 --pubkey-pem leafkeypub.pem --output testenc.x ml template2.xml the above works and I can see the encrypted data in ciphervalue node of the output document testenc.xml (also attached). However, when I try the reverse, i.e, decrypting the document from above step I get error below Decryption fails:- C:\xmlsecutility\libxmlsec-1.2.10.win32\bin\examplexmlsec --decrypt --privkey-p em leafkey.pem --output testdecrypt.xml testenc.xml Enter password for leafkey.pem file: func=xmlSecKeysMngrGetKey:file=..\src\keys.c:line=1364:obj=unknown:subj=xmlSecKe ysMngrFindKey: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=xmlSecEncCtxDecrypt:file=..\src\xmlenc.c:line=582:obj=unknown:subj=xmlSecEn cCtxDecryptToBuffer:error=1:xmlsec library function failed: Error: failed to decrypt file Error: failed to decrypt file testenc.xml The error says “key not found”, but key is in the same folder where I am running it from. I am also attaching the private key (password – leaf) and public key that corresponds to it I am attaching all the relevant files. Any pointers are appreciated. Thanks. -Bala ___ xmlsec mailing list xmlsec@aleksey.com http://www.aleksey.com/mailman/listinfo/xmlsec ___ xmlsec mailing list xmlsec@aleksey.com http://www.aleksey.com/mailman/listinfo/xmlsec