public override byte[] DeriveKeyFromHmac(
            ECDiffieHellmanPublicKey otherPartyPublicKey,
            HashAlgorithmName hashAlgorithm,
            byte[] hmacKey,
            byte[] secretPrepend,
            byte[] secretAppend)
        {
            if (otherPartyPublicKey == null)
            {
                throw new ArgumentNullException(nameof(otherPartyPublicKey));
            }
            if (string.IsNullOrEmpty(hashAlgorithm.Name))
            {
                throw new ArgumentException(SR.Cryptography_HashAlgorithmNameNullOrEmpty, nameof(hashAlgorithm));
            }

            ThrowIfDisposed();

            return(ECDiffieHellmanDerivation.DeriveKeyFromHmac(
                       otherPartyPublicKey,
                       hashAlgorithm,
                       hmacKey,
                       secretPrepend,
                       secretAppend,
                       (pubKey, hasher) => DeriveSecretAgreement(pubKey, hasher)));
        }
Exemple #2
0
        public override byte[] DeriveKeyFromHmac(
            ECDiffieHellmanPublicKey otherPartyPublicKey,
            HashAlgorithmName hashAlgorithm,
            byte[]?hmacKey,
            byte[]?secretPrepend,
            byte[]?secretAppend)
        {
            ArgumentNullException.ThrowIfNull(otherPartyPublicKey);
            ArgumentException.ThrowIfNullOrEmpty(hashAlgorithm.Name, nameof(hashAlgorithm));

            ThrowIfDisposed();

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