예제 #1
0
        private static RSA BuildRsaPublicKey(byte[] encodedData)
        {
            using (SafeRsaHandle rsaHandle = Interop.Crypto.DecodeRsaPublicKey(encodedData, encodedData.Length))
            {
                Interop.Crypto.CheckValidOpenSslHandle(rsaHandle);

                RSAParameters rsaParameters = Interop.Crypto.ExportRsaParameters(rsaHandle, false);
                RSA rsa = new RSAOpenSsl();
                rsa.ImportParameters(rsaParameters);
                return rsa;
            }
        }
예제 #2
0
        private static unsafe RSA BuildRsaPublicKey(byte[] encodedData)
        {
            using (SafeRsaHandle rsaHandle = Interop.libcrypto.OpenSslD2I(Interop.libcrypto.d2i_RSAPublicKey, encodedData))
            {
                Interop.libcrypto.CheckValidOpenSslHandle(rsaHandle);

                RSAParameters rsaParameters = Interop.libcrypto.ExportRsaParameters(rsaHandle, false);
                RSA rsa = new RSAOpenSsl();
                rsa.ImportParameters(rsaParameters);
                return rsa;
            }
        }
 public RSACryptoServiceProvider()
 {
     _defer = new RSAOpenSsl();
 }
 public RSACryptoServiceProvider(int dwKeySize)
 {
     _defer = new RSAOpenSsl(dwKeySize);
 }
 public RSACryptoServiceProvider(int dwKeySize)
 {
     _defer = new RSAOpenSsl(dwKeySize);
     _legalKeySizesValue = _defer.LegalKeySizes;
 }