Re: CryptoAPI and private key /not public/ encryption with CryptEncrypt - can not use CryptHash* functions
From: Valery Pryamikov (Valery_at_nospam.harper.no)
Date: 12/26/04
- Next message: mmicko_at_gmail.com: "Implementation of CertStoreProvFindCert"
- Previous message: Przemek Wasylko: "CryptoAPI and private key /not public/ encryption with CryptEncrypt - can not use CryptHash* functions"
- In reply to: Przemek Wasylko: "CryptoAPI and private key /not public/ encryption with CryptEncrypt - can not use CryptHash* functions"
- Next in thread: Przemek Wasylko: "Re: CryptoAPI and private key /not public/ encryption with CryptEncrypt - can not use CryptHash* functions"
- Reply: Przemek Wasylko: "Re: CryptoAPI and private key /not public/ encryption with CryptEncrypt - can not use CryptHash* functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sun, 26 Dec 2004 20:10:56 +0100
Hi,
if you have hash value that fits some standard hash (ex. use MD5 if it is
128 bits or SHA1 if hash is 160 bits or CALG_SSL3_SHAMD5 if it is 288 bits)
then you can use CryptSetHashParam with HP_HASHVAL, and use CryptSignHash to
sign it.
Since cryptographic hash value is essentially a random number - no
restrictions could be added to CryptSetHashParam with HP_HASHVAL except for
bitlength. So, if you have value of RIPEMD-160 or HAVAL you can just stick
it's value into SHA1/MD5 hash and sign it.
-Valery.
http://www.harper.no/valery
"Przemek Wasylko" <wasylek@remove-me.megapolis.pl> wrote in message
news:%230pEWR16EHA.2488@TK2MSFTNGP14.phx.gbl...
> Hello All :)
>
> I have 3rd party library that supplies me with calculated by itself hash
> of some data (so I can not use CryptHashData, etc). I don't know hash
> method, I'm only supposed to encrypt that hash using private key in order
> to create digital signature. I have SmartCard CSP with public/private
> keypair stored on it. I would like to encrypt that SHA1 hash, but using
> private key not the public one (in order to have another party validate
> signature by using public key provided by me - i can extract public key
> from smartcard ). But unfortunatelly I have found no obvious way to do
> that by using CryptoAPI, maybe I am missing something. MSDN and other
> sources force me to use CryptCreateHash/CryptHashData/CryptSignHash, but,
> as I mentioned before, I can't do that (my code does not calculate hash).
> I would like to use CryptEncrypt with private key and CryptDecrypt with
> public key. Is there solution to my problem ?
>
> Best regards
> Przemek Wasylko
- Next message: mmicko_at_gmail.com: "Implementation of CertStoreProvFindCert"
- Previous message: Przemek Wasylko: "CryptoAPI and private key /not public/ encryption with CryptEncrypt - can not use CryptHash* functions"
- In reply to: Przemek Wasylko: "CryptoAPI and private key /not public/ encryption with CryptEncrypt - can not use CryptHash* functions"
- Next in thread: Przemek Wasylko: "Re: CryptoAPI and private key /not public/ encryption with CryptEncrypt - can not use CryptHash* functions"
- Reply: Przemek Wasylko: "Re: CryptoAPI and private key /not public/ encryption with CryptEncrypt - can not use CryptHash* functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|