Пример #1
0
        public override byte[] DeriveKeyTls(ECDiffieHellmanPublicKey otherPartyPublicKey, byte[] prfLabel, byte[] prfSeed)
        {
            if (this.publicKey == null)
            {
                CreateKeys();
            }
            if (this.privateKey == null)
            {
                throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey);
            }

            return(ECDiffieHellmanDerivation.DeriveKeyTls(otherPartyPublicKey, prfLabel, prfSeed, DeriveSecretAgreement));
        }
Пример #2
0
        public override byte[] DeriveKeyFromHmac(ECDiffieHellmanPublicKey otherPartyPublicKey, HashAlgorithmName hashAlgorithm, byte[]?hmacKey, byte[]?secretPrepend, byte[]?secretAppend)
        {
            if (this.publicKey == null)
            {
                CreateKeys();
            }
            if (this.privateKey == null)
            {
                throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey);
            }
            if (string.IsNullOrEmpty(hashAlgorithm.Name))
            {
                throw new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, nameof(hashAlgorithm));
            }

            return(ECDiffieHellmanDerivation.DeriveKeyFromHmac(otherPartyPublicKey, hashAlgorithm, hmacKey, secretPrepend, secretAppend, DeriveSecretAgreement));
        }