f9fj
Mon May 15 07:10:33 CDT 2006
tomstdenis@gmail.com =E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8:
> mh wrote:
> > Hi, all!
> > I want to create a program using CryptoAPI which calculates HMAC-SHA1
> > using a key specified by PLAINTEXTKEYBLOB.
> > I have a 20-byte key for HMAC-SHA1 and want to use it.
> > How should I do?
> > Should I import the key by CryptImportKey()?
> > But I have to specify an encryption key algorithm and I donno which
> > algorithm I should use.
> > Your kind help is welcomed.
>
> Why are you using the MS CryptoAPI?
>
> Tom
Because MS CryptoAPI is a standard cryptographic module for Windows and
we are asked by our customers to make a program for computers with
Windows environment.
In fact, the problem is now resolved!
According to the document published by Microsoft
(
http://csrc.nist.gov/cryptval/140-1/140sp/140sp382.pdf ), we should
use CALG_RC2 as the key algorithm of PLAINTEXTKEYBLOB, and import the
blob by CryptImportKey() with the flag CRYPT_IPSEC_HMAC_KEY specified.
By using this technique, we could calculate a correct HMAC value!!