Exemplo n.º 1
0
        private PrivateKeySigner(string privateKey)
        {
            if (privateKey == null)
            {
                throw new ArgumentNullException("privateKey");
            }

            _key = OpenSslKey.DecodeOpenSSLPrivateKey(privateKey);
        }
Exemplo n.º 2
0
        public byte[] Sign(byte[] data, SigningAlgorithm algorithm)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            using (var rsa = OpenSslKey.DecodeRSAPrivateKey(_key))
            {
                byte[] signature = rsa.SignData(data, GetHashName(algorithm));

                return(signature);
            }
        }