Richard Levitte - VMS Whacker wrote:
>
> From: "kure" <[EMAIL PROTECTED]>
>
> kure> Is it possible to add Microsoft CryptoAPI 2.0 as one of crypto engine?
> kure> Maybe somebody have alredy done it?
>
> Noone so far. Wanna have the honors? :-)
>
This depends to some extent on what you want to do with it.
I have written a RSA_METHOD (not an ENGINE) that used CryptoAPI and it
works up to a point with some restrictions. The code has never been
publically released.
CryptoAPI doesn't have a standard which supports arbitrary RSA
operations. You can however sign and verify data and under some CSPs
(the MS enhanced CSP is one) you can encrypt and decrypt data using
PKCS#1 padding. This is sufficient to do S/MIME, SSLv3 and TLS. You
can't do SSLv2 though because the padding is different.
The actual API calls you need to do this are not at all obvious and the
RSA encrypt/decrypt is almost completely undocumented. This lead many to
believe (including me initially) that using CryptoAPI to replace OpenSSL
RSA was impossible.
By itself you wouldn't gain much from this. You could use CryptoAPI as a
"accelerator" except that its software performance is rather slower than
OpenSSL. CryptoAPI also has thread safe issues and has no concept of a
"session private key" you have to create the things in a key container
and destroy them after use.
Also the MS providers don't support arbitrary private keys. They have to
be a multiple of 64 bits and certain keys cannot be represented at all
(where p and q are different sizes for example or where the public
exponent is > 32 bits).
However if a hardware crypto accelerator had a CryptoAPI driver and it
supported the relevant operations then this would have a use.
A better application would be use of CryptoAPI keys and certificates. It
is possible to have private keys that are unexportable or protected by
hardware. Provided the relevant CSP supported the necessary operations
it would be possible to make use of CryptoAPI based smart card CSPs in
OpenSSL.
I'd regard support for the "necessary operations" as rather a big
condition considering how well hidden this information is. A typical CSP
could work just fine with CryptoAPI and not need to support the RSA
encrypt and decrypt operations at all. However it is required to support
sign and verify so an arbitrary smart card CSP may well support
authentication only but not encryption and decryption.
I haven't kept up with ENGINE development but it would need some
flexible way to handle hardware keys to support this.
Steve.
--
Dr Stephen N. Henson. http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED]
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]