コード例 #1
0
        public static ICryptoValue DecryptByPublicKey(byte[] cipherData, string publicKey, RsaKeyFormat format, bool fOEAP)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPublicKey(cipherData));
        }
コード例 #2
0
        public static bool VerifyByPrivateKey(string originalText, string signature, string privateKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.VerifyByPrivateKey(originalText, signature, hashAlgorithmName, padding, encoding));
        }
コード例 #3
0
        public static ISignValue SignByPublicKey(string originalText, string publicKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.SignByPublicKey(originalText, hashAlgorithmName, padding, encoding));
        }
コード例 #4
0
        public static bool VerifyByPrivateKey(byte[] originalData, byte[] signature, string privateKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.VerifyByPrivateKey(originalData, signature, hashAlgorithmName, padding));
        }
コード例 #5
0
        public static ISignValue SignByPrivateKey(byte[] originalData, string privateKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.SignByPrivateKey(originalData, hashAlgorithmName));
        }
コード例 #6
0
        public static ISignValue SignByPublicKey(byte[] originalData, string publicKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.SignByPublicKey(originalData, hashAlgorithmName, padding));
        }
コード例 #7
0
        public static ICryptoValue DecryptByPrivateKey(byte[] cipherData, string privateKey, RsaKeyFormat format, RSAEncryptionPadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPrivateKey(cipherData, padding));
        }
コード例 #8
0
        public static ICryptoValue DecryptByPrivateKey(string cipherText, string privateKey, RsaKeyFormat format, RSAEncryptionPadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPrivateKey(cipherText, padding, encoding));
        }
コード例 #9
0
        public static ICryptoValue EncryptByPublicKey(byte[] originalData, string publicKey, RsaKeyFormat format, RSAEncryptionPadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.EncryptByPublicKey(originalData, padding));
        }
コード例 #10
0
        public static ICryptoValue DecryptByPublicKey(string cipherText, string publicKey, RsaKeyFormat format, bool fOEAP, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPublicKey(cipherText, encoding));
        }
コード例 #11
0
        public static ICryptoValue EncryptByPublicKey(string originalText, string publicKey, RsaKeyFormat format, RSAEncryptionPadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.EncryptByPublicKey(originalText, padding, encoding));
        }
コード例 #12
0
        public static ICryptoValue EncryptByPrivateKey(byte[] originalData, string privateKey, RsaKeyFormat format)
        {
            var key      = RsaKeyGenerator.GeneratePrivateKey(privateKey, format);
            var function = Factory.Create(key);

            return(function.EncryptByPrivateKey(originalData));
        }
コード例 #13
0
 public static IRSA CreateWithPrivateKey(string key, RsaKeyFormat keyFormat) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKey(key, keyFormat));
コード例 #14
0
 public static IRSA CreateWithKeyInJson(string key) => new RsaFunction(RsaKeyGenerator.GenerateInJson(key));
コード例 #15
0
 public static IRSA CreateWithPrivateKeyFromFile(string certFile, string password) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKeyFromFile(certFile, password));
コード例 #16
0
 public static IRSA CreateWithPublicKeyFromFile(string certFile) => new RsaFunction(RsaKeyGenerator.GeneratePublicKeyFromFile(certFile));
コード例 #17
0
 public static IRSA CreateWithPrivateKeyInPkcs8(string key) => new RsaFunction(RsaKeyGenerator.GeneratePrivateKeyInPkcs8(key));
コード例 #18
0
 public static IRSA CreateWithPublicKeyInPkcs1(string key) => new RsaFunction(RsaKeyGenerator.GeneratePublicKeyInPkcs1(key));