|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CryptoAPIHello everyone,
I need to convert some code that works with CryptoAPI using advapi32.dll to C#.NET and to use System.Security.Cryptography. The question is what is the analog for CryptImportKey API? In the old code they giving to this CryptImportKey a private key which is byte array 596 bytes length. Thanks, Maxim That 596 byte is a MS PRIVATEKEYBLOB unencrypted blob.
..NET api does not support importing these blob types. You will need to use PInvoke from .NET 1.1 / 2 to import that RSA keypair. Some samples showing how to set up capi fn prototypes and structs are here: http://www.jensign.com/JavaScience/cryptoutils Also, you can manually import that unencrypted PRIVATEKEYBLOB (if in a file) using the .NET tool sn.exe .. e.g. sn -i yourprivatekey.snk MyContainer but this only works if the privatekeyblob specifies the key as AT_SIGNATURE. - Mitch Gallant MVP Security <zabutima***@gmail.com> wrote in message Show quoteHide quote news:1139754639.488025.256920@z14g2000cwz.googlegroups.com... > Hello everyone, > > I need to convert some code that works with CryptoAPI using > advapi32.dll to C#.NET and to use > System.Security.Cryptography. The question is what is the analog for > CryptImportKey API? In the old code they giving to this CryptImportKey > a private key which is byte array 596 bytes length. > > Thanks, > Maxim > Mitch,
Thanks for answer. Actually we already using it with PInvoke from .NET, but unfortunatly, we experiencing probelms with that way, because it looks like CryptoAPI is not fully thread safe. Under load more then ~30 concurrent threads it starts to return garbage in decrypted string. So we thought to try to use System.Security.Cryptography. We tried to use PInvoke and synchronize threads, but it also did not help, it looks like CAPI is not just advapi32.dll, but behind it there is some extenral process that advapi32.dll just talking with it (like RPC). So it does not help if I synchronize my own threads. And we also found that there are few people that has same problems with CAPI. Any advise? Regards, Maxim.
Problem with RSA.ImportParameters() under ASP .NET
AuthenticateAsServer/AuthenticateAsClient ProtectionLevel and iden Running application in local intranet HOWTO Run CASPOL for full trust on UserControl. .NET 2.0, X509Certificates and CRL Check Issues With User Control Embedded Into Web Page Since Installing .NET 2.0 CAS exception - crash Translate BUILTIN to domain name Encyption NEED Solution for .NET 2.0 mscorcfg.msc w/o SDK |
|||||||||||||||||||||||