You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Milan Tomic <mi...@setcce.org> on 2004/04/28 16:37:42 UTC
Encryption
I'm trying to encrypt some XML using WinCAPICryptoKeyRSA():
HCRYPTPROV win32RSACSP = 0;
CryptAcquireContext(&win32RSACSP, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
kek = new WinCAPICryptoKeyRSA(win32RSACSP);
and I got "XENCAlgorithmHandlerDefault::mapURIToKey - key
inappropriate for URI" exception. Why? The rest of the code is from
cipher.cpp. I couldn't find any example how to use WinCAPICryptoKeyRSA
in encryption.
Thank you.
Re: Encryption
Posted by Berin Lautenbach <be...@wingsofhermes.org>.
Milan,
Have you had a look inside xtest.cpp?
There is some code in there that *might* help. (It also might not :<.)
In particular, have a look at "unitTestEncrypt()". This sets up a
WinCAPI RSA key and calls "unitTestKeyEncrypt()" to wrap an encryption key.
That particular error would indicate (for example) an RSA key passed
into something that is expecting a Symmetric key. E.g. the XENCCipher
object is set to do AES encryption and gets passed an RSA key.
Cheers,
Berin
Milan Tomic wrote:
>
> I'm trying to encrypt some XML using WinCAPICryptoKeyRSA():
>
> HCRYPTPROV win32RSACSP = 0;
> CryptAcquireContext(&win32RSACSP, NULL, NULL, PROV_RSA_FULL,
> CRYPT_VERIFYCONTEXT);
>
> kek = new WinCAPICryptoKeyRSA(win32RSACSP);
>
> and I got "XENCAlgorithmHandlerDefault::mapURIToKey - key
> inappropriate for URI" exception. Why? The rest of the code is from
> cipher.cpp. I couldn't find any example how to use WinCAPICryptoKeyRSA
> in encryption.
>
> Thank you.
>