Beispiel #1
0
        public static bool VerifyByPublicKey(byte[] originalData, byte[] signature, string publicKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.VerifyByPublicKey(originalData, signature, hashAlgorithmName, padding));
        }
Beispiel #2
0
        public static bool VerifyByPublicKey(string originalText, string signature, string publicKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, RSASignaturePadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.VerifyByPublicKey(originalText, signature, hashAlgorithmName, padding, encoding));
        }
Beispiel #3
0
        public static ISignValue SignByPublicKey(byte[] originalData, string publicKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.SignByPublicKey(originalData, hashAlgorithmName));
        }
Beispiel #4
0
        public static ISignValue SignByPublicKey(string originalText, string publicKey, RsaKeyFormat format, HashAlgorithmName hashAlgorithmName, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.SignByPublicKey(originalText, hashAlgorithmName, encoding));
        }
Beispiel #5
0
        public static ICryptoValue DecryptByPublicKey(string cipherText, string publicKey, RsaKeyFormat format, RSAEncryptionPadding padding, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPublicKey(cipherText, padding, encoding));
        }
Beispiel #6
0
        public static ICryptoValue DecryptByPublicKey(byte[] cipherData, string publicKey, RsaKeyFormat format, RSAEncryptionPadding padding)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.DecryptByPublicKey(cipherData, padding));
        }
Beispiel #7
0
        public static ICryptoValue EncryptByPublicKey(string originalText, string publicKey, RsaKeyFormat format, bool fOEAP, Encoding encoding = null)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.EncryptByPublicKey(originalText, fOEAP, encoding));
        }
Beispiel #8
0
        public static ICryptoValue EncryptByPublicKey(byte[] originalData, string publicKey, RsaKeyFormat format, bool fOEAP)
        {
            var key      = RsaKeyGenerator.GeneratePublicKey(publicKey, format);
            var function = Factory.Create(key);

            return(function.EncryptByPublicKey(originalData, fOEAP));
        }
Beispiel #9
0
 public static IRSA CreateWithPublicKey(string key, RsaKeyFormat keyFormat) => new RsaFunction(RsaKeyGenerator.GeneratePublicKey(key, keyFormat));