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.

Re: MS CryptoAPI: HMAC using PLAINTEXTKEYBLOB by tomstdenis

tomstdenis
Mon May 15 06:30:46 CDT 2006


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


Re: MS CryptoAPI: HMAC using PLAINTEXTKEYBLOB by f9fj

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!!


Re: MS CryptoAPI: HMAC using PLAINTEXTKEYBLOB by tomstdenis

tomstdenis
Mon May 15 08:18:29 CDT 2006

f9fj@yahoo.co.jp wrote:
> 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.

I'm gonna go out on a limb here and suggest that you look into OSS
alternatives. There are crypto libraries that work in Windows.

> 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!!

So the solution to make HMAC work is to specify a block cipher? I
think my head just asploded.

Tom


Re: MS CryptoAPI: HMAC using PLAINTEXTKEYBLOB by clark

clark
Mon May 15 11:11:30 CDT 2006

On 15 May 2006 05:10:33 -0700, f9fj@yahoo.co.jp wrote:

>tomstdenis@gmail.com ??????:
>
>> 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!!


Here's additional reference:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/creating_an_hmac.asp




Re: MS CryptoAPI: HMAC using PLAINTEXTKEYBLOB by f9fj

f9fj
Mon May 15 19:29:16 CDT 2006


Felix Rawlings =E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8:

> On Mon, 15 May 2006 05:10:33 -0700, f9fj wrote:
>
> > tomstdenis@gmail.com:
> >
> >> 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.
>
> That does not imply that you must use MS CryptoAPI. Or is it the case
> that your customers are explicitly mandating for you to use MS CryptoAPI?

We've started developing a program with Ms CryptAPI, so we cannot
change the decision.
Thank you for your attention.