[xmlsec] explicitly set key in decrypt3 example failing

Aleksey Sanin aleksey at aleksey.com
Wed Mar 3 19:38:39 PST 2010


Sorry, I looked at the example - the decrypt3 example uses
a *custom* keys manager, it is a simple example that doesn't
do everything.

Take a look at decrypt1 example - it does *exactly* what you want.


Aleksey

On 3/3/2010 5:08 PM, Kent Watsen wrote:
>
> I've tried both removing the KeyName element as well as the entire KeyInfo element - neither works, same error
>
> By your suggestions, I take it that you'd expect this to work too
>
> Thanks,
> Kent
>
>
>
>
>> -----Original Message-----
>> From: Aleksey Sanin [mailto:aleksey at aleksey.com]
>> Sent: Wednesday, March 03, 2010 7:12 PM
>> To: Kent Watsen
>> Cc: 'xmlsec at aleksey.com'
>> Subject: Re: [xmlsec] explicitly set key in decrypt3 example failing
>>
>> Remove KeyName element from xml.
>>
>> Aleksey
>>
>> On 3/3/2010 3:48 PM, Kent Watsen wrote:
>>>
>>> The decrypt3 example normally has the following KeyInfo:
>>>
>>>     <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
>>>       <KeyName>rsakey.pem</KeyName>
>>>     </KeyInfo>
>>>
>>> So it is the same key in both cases.  It's just that now the code is
>> trying to use it without a key manager - any ideas?
>>>
>>> Thanks,
>>> Kent
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Aleksey Sanin [mailto:aleksey at aleksey.com]
>>>> Sent: Wednesday, March 03, 2010 6:36 PM
>>>> To: Kent Watsen
>>>> Cc: 'xmlsec at aleksey.com'
>>>> Subject: Re: [xmlsec] explicitly set key in decrypt3 example failing
>>>>
>>>> The key needs to match the crypto algorithm you are using in xml.
>>>>
>>>> Aleksey
>>>>
>>>> On 3/3/2010 3:05 PM, Kent Watsen wrote:
>>>>> Hi,
>>>>>
>>>>> I'm trying to simplify decrypt3 example by explicitly setting
>>>>> encCtx->encKey instead of relying on a keys mngr. Specifically, I
>>>> changed:
>>>>>
>>>>> encCtx = xmlSecEncCtxCreate(mngr);
>>>>>
>>>>> To:
>>>>>
>>>>> encCtx = xmlSecEncCtxCreate(NULL);
>>>>>
>>>>> encCtx->encKey = xmlSecCryptoAppKeyLoad("rsakey.pem",
>>>>> xmlSecKeyDataFormatPem, NULL, NULL, NULL);
>>>>>
>>>>> But I get errors:
>>>>>
>>>>>
>>>>
>> func=xmlSecEncCtxEncDataNodeRead:file=xmlenc.c:line=885:obj=unknown:subj=u
>>>> nknown:error=45:key
>>>>> is not found:
>>>>>
>>>>>
>>>>
>> func=xmlSecEncCtxDecryptToBuffer:file=xmlenc.c:line=643:obj=unknown:subj=x
>>>> mlSecEncCtxEncDataNodeRead:error=1:xmlsec
>>>>> library function failed:
>>>>>
>>>>>
>>>>
>> func=xmlSecEncCtxDecrypt:file=xmlenc.c:line=582:obj=unknown:subj=xmlSecEnc
>>>> CtxDecryptToBuffer:error=1:xmlsec
>>>>> library function failed:
>>>>>
>>>>> Error: decryption failed
>>>>>
>>>>> Should explicitly setting the key work?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Kent
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> xmlsec mailing list
>>>>> xmlsec at aleksey.com
>>>>> http://www.aleksey.com/mailman/listinfo/xmlsec
>>> _______________________________________________
>>> xmlsec mailing list
>>> xmlsec at aleksey.com
>>> http://www.aleksey.com/mailman/listinfo/xmlsec


More information about the xmlsec mailing list