[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-cryptoapi
Subject:    Re: CryptoAPI to do DES encryption
From:       Eric Rosenquist <eric () ROSENQUIST ! COM>
Date:       1999-10-27 19:36:35
[Download RAW message or body]


You don't need to worry about the private key format from the sample; the
structure is that of a PRIVATEKEYBLOB.  Import it the way the sample does to
get it temporarily into the CSP.  Then create a SIMPLEBLOB structure where
the "encryptedkey" field is your plaintext DES key with appropriate PKCS#1
padding.  The SIMPLEBLOB data, like the PrivateKeyWithExponentOfOne in the
sample, can be generated at compile-time.  What you're doing is getting a
dummy RSA key pair into the CSP so that you can do null RSA encryption.

I don't recall the PKCS#1 padding details offhand, but that's the only bit
that's somewhat tricky.  It might even work if you took the example code in
Q228786 and let it go ahead and generate and export the symmetric key (use
DES though, not RC4), then replace the 8 bytes of symmetric key in the blob
with your DES key and import it.  That's more wasteful than just hard-coding
the correct buffer ahead of time though since you force the CSP to generate
a key and you'll have an extra symmetric key kicking around for a short
while.

Eric
---
Eric Rosenquist, Entrust Technologies  http://www.entrust.com/
mailto:Eric.Rosenquist@entrust.com     Telephone: 613-591-1922
Quote: God bless those pagans. -- Homer Simpson


-----Original Message-----
From: Jason Gauntz [mailto:Jason_Gauntz@STERCOMM.COM]
Sent: Wednesday, October 27, 1999 08:41
To: Microsoft Cryptographic API
Subject: Re: CryptoAPI to do DES encryption


I did take a look at the KB article Q228786 and the thing I did not
understand
was the syntax of the private key.  They have a variable called
PrivateKeyWithExponentOne[ ].   What I don't understand is the syntax.  In
this
array, where is the key itself???  They talk about prime1, prm2, exp1, exp2,
coefficient, and private exponent.  I know that exp1, exp2, and
privateExponenet
must be set to one.  But what do I use for prime1, prime2, and coefficient.
I
could not find where each of these parts is explained.  How do I know what
values to assign for each one of these.  Any help would be greatly
appreciated.

Jason

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic