BaseCipherSuitePlugin.SignatureAlgorithmDSA.SignData C# (CSharp) Метод

SignData() публичный Метод

public SignData ( ProtocolVersion version, byte data, HashAlgorithm hashAlgorithm, AaltoTLS.PluginInterface.CertificatePrivateKey privateKey ) : byte[]
version AaltoTLS.PluginInterface.ProtocolVersion
data byte
hashAlgorithm System.Security.Cryptography.HashAlgorithm
privateKey AaltoTLS.PluginInterface.CertificatePrivateKey
Результат byte[]
        public override byte[] SignData(ProtocolVersion version, byte[] data, HashAlgorithm hashAlgorithm, CertificatePrivateKey privateKey)
        {
            if (hashAlgorithm != null && !(hashAlgorithm is SHA1)) {
                throw new Exception("DSA signature requires SHA1 hash algorithm");
            }
            if (!(privateKey.Algorithm is DSACryptoServiceProvider)) {
                throw new Exception("DSA signature requires DSA private key");
            }

            DSACryptoServiceProvider dsaKey = (DSACryptoServiceProvider) privateKey.Algorithm;
            if (dsaKey.PublicOnly) {
                throw new Exception("DSA private key required for signing");
            }

            return DEREncodeSignature(dsaKey.SignData(data));
        }