[prev in list] [next in list] [prev in thread] [next in thread]
List: ms-cryptoapi
Subject: Re: sample code
From: albert decker <albert_decker () PROTELINC ! COM>
Date: 1997-12-30 20:42:43
[Download RAW message or body]
>could anybody tell me how I can store the
>PRIVATE KEY on disk and how to use it late to decrypt the data.
Sure. (Omitting the usual overhead of acquiring contexts and so on...)
To make the diskette:
1. Create the key as an exportable key (or import it).
2. Export the key as a PRIVATEKEYBLOB, encrypting it or not as you will.
(Encrypting using a key derived from a password is a pretty good
option, IMHO.) [Use CryptExportKey]
3. Export the key as a PUBLICKEYBLOB. [Use CryptExportKey]
4. Delete the key.
5. Write the (encrypted) PRIVATEKEYBLOB into a file (on diskette)
5. Save the PUBLICKEYBLOB "somewhere". (So that you can distribute it
later...)
Then if someone encrypts a file/record/whatever using your public key,
you can decrypt it as follows:
1. Import the PRIVATEKEYBLOB from wherever you stored it, decrypting it
if needed.
2. Decrypt files, records, etc.
3. Delete the imported key.
Hope this helps.
>
----------------------------------------------------------------
Users Guide http://www.microsoft.com/sitebuilder/resource/mailfaq.asp
contains important info including how to unsubscribe. Save time, search
the archives at http://microsoft.ease.lsoft.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