public bool VerifyData(byte[] data, int offset, int count, byte[] signature) { if (data == null) { throw new ArgumentNullException("data"); } if (offset < 0 || offset > data.Length) { throw new ArgumentOutOfRangeException("offset"); } if (count < 0 || count > data.Length - offset) { throw new ArgumentOutOfRangeException("count"); } if (signature == null) { throw new ArgumentNullException("signature"); } using (BCryptHashAlgorithm hashAlgorithm = new BCryptHashAlgorithm(HashAlgorithm, BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hashAlgorithm.HashCore(data, offset, count); byte[] hashValue = hashAlgorithm.HashFinal(); return(VerifyHash(hashValue, signature)); } }
public static byte[] SignData( this ECDsaCng ecdsaCng, byte[] data, int offset, int count) { Contract.Ensures(Contract.Result <byte[]>() != null); if (data == null) { throw new ArgumentNullException("data"); } if (offset < 0 || offset > data.Length) { throw new ArgumentOutOfRangeException("offset"); } if (count < 0 || count > data.Length - offset) { throw new ArgumentOutOfRangeException("count"); } using (var hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha256, BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hashAlgorithm.HashCore(data, offset, count); byte[] hashValue = hashAlgorithm.HashFinal(); return(ecdsaCng.SignHash(hashValue)); } }
public SHA512Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha512, BCryptNative.ProviderName.MicrosoftPrimitiveProvider); }
public bool VerifyData(byte[] data, int offset, int count, byte[] signature) { if (data == null) { throw new ArgumentNullException("data"); } if ((offset < 0) || (offset > data.Length)) { throw new ArgumentOutOfRangeException("offset"); } if ((count < 0) || (count > (data.Length - offset))) { throw new ArgumentOutOfRangeException("count"); } if (signature == null) { throw new ArgumentNullException("signature"); } using (BCryptHashAlgorithm algorithm = new BCryptHashAlgorithm(this.HashAlgorithm, "Microsoft Primitive Provider")) { algorithm.HashCore(data, offset, count); byte[] hash = algorithm.HashFinal(); return(this.VerifyHash(hash, signature)); } }
public MD5Cng() { if (CryptoConfig.AllowOnlyFipsAlgorithms) { throw new InvalidOperationException(System.SR.GetString("Cryptography_NonCompliantFIPSAlgorithm")); } this.m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.MD5, "Microsoft Primitive Provider"); }
public MD5Cng() { if (CryptoConfig.AllowOnlyFipsAlgorithms) { throw new InvalidOperationException(System.SR.GetString("Cryptography_NonCompliantFIPSAlgorithm")); } this.m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.MD5, "Microsoft Primitive Provider"); }
public MD5Cng() { Contract.Ensures(m_hashAlgorithm != null); if (CryptoConfig.AllowOnlyFipsAlgorithms) { throw new InvalidOperationException(SR.GetString(SR.Cryptography_NonCompliantFIPSAlgorithm)); } m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.MD5, BCryptNative.ProviderName.MicrosoftPrimitiveProvider); }
protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) { // we're sealed and the base should have checked this before calling us Debug.Assert(data != null); Debug.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name)); using (BCryptHashAlgorithm hasher = new BCryptHashAlgorithm(new CngAlgorithm(hashAlgorithm.Name), BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hasher.HashStream(data); return(hasher.HashFinal()); } }
public MD5Cng() { Contract.Ensures(m_hashAlgorithm != null); if (CryptoConfig.AllowOnlyFipsAlgorithms && LocalAppContextSwitches.UseLegacyFipsThrow) { throw new InvalidOperationException(SR.GetString(SR.Cryptography_NonCompliantFIPSAlgorithm)); } m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.MD5, BCryptNative.ProviderName.MicrosoftPrimitiveProvider); }
public byte[] SignData(Stream data) { if (data == null) { throw new ArgumentNullException("data"); } using (BCryptHashAlgorithm algorithm = new BCryptHashAlgorithm(this.HashAlgorithm, "Microsoft Primitive Provider")) { algorithm.HashStream(data); byte[] hash = algorithm.HashFinal(); return(this.SignHash(hash)); } }
protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) { // we're sealed and the base should have checked this before calling us Debug.Assert(data != null); Debug.Assert(offset >= 0 && offset <= data.Length); Debug.Assert(count >= 0 && count <= data.Length - offset); Debug.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name)); using (BCryptHashAlgorithm hasher = new BCryptHashAlgorithm(new CngAlgorithm(hashAlgorithm.Name), BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hasher.HashCore(data, offset, count); return(hasher.HashFinal()); } }
public byte[] SignData(Stream data) { Contract.Ensures(Contract.Result <byte[]>() != null); if (data == null) { throw new ArgumentNullException("data"); } using (BCryptHashAlgorithm hashAlgorithm = new BCryptHashAlgorithm(HashAlgorithm, BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hashAlgorithm.HashStream(data); byte[] hashValue = hashAlgorithm.HashFinal(); return(SignHash(hashValue)); } }
public bool VerifyData(Stream data, byte[] signature) { if (data == null) { throw new ArgumentNullException("data"); } if (signature == null) { throw new ArgumentNullException("signature"); } using (BCryptHashAlgorithm algorithm = new BCryptHashAlgorithm(this.HashAlgorithm, "Microsoft Primitive Provider")) { algorithm.HashStream(data); byte[] hash = algorithm.HashFinal(); return(this.VerifyHash(hash, signature)); } }
public bool VerifyData(Stream data, byte[] signature) { if (data == null) { throw new ArgumentNullException("data"); } if (signature == null) { throw new ArgumentNullException("signature"); } using (BCryptHashAlgorithm hashAlgorithm = new BCryptHashAlgorithm(HashAlgorithm, BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hashAlgorithm.HashStream(data); byte[] hashValue = hashAlgorithm.HashFinal(); return(VerifyHash(hashValue, signature)); } }
public bool VerifyData(Stream data, byte[] signature) { if (data == null) { throw new ArgumentNullException("data"); } if (signature == null) { throw new ArgumentNullException("signature"); } using (BCryptHashAlgorithm hashAlgorithm = new BCryptHashAlgorithm(HashAlgorithm, BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hashAlgorithm.HashStream(data); byte[] hashValue = hashAlgorithm.HashFinal(); return VerifyHash(hashValue, signature); } }
public byte[] SignData(Stream data) { Contract.Ensures(Contract.Result<byte[]>() != null); if (data == null) { throw new ArgumentNullException("data"); } using (BCryptHashAlgorithm hashAlgorithm = new BCryptHashAlgorithm(HashAlgorithm, BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hashAlgorithm.HashStream(data); byte[] hashValue = hashAlgorithm.HashFinal(); return SignHash(hashValue); } }
public bool VerifyData(byte[] data, int offset, int count, byte[] signature) { if (data == null) { throw new ArgumentNullException("data"); } if (offset < 0 || offset > data.Length) { throw new ArgumentOutOfRangeException("offset"); } if (count < 0 || count > data.Length - offset) { throw new ArgumentOutOfRangeException("count"); } if (signature == null) { throw new ArgumentNullException("signature"); } using (BCryptHashAlgorithm hashAlgorithm = new BCryptHashAlgorithm(HashAlgorithm, BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hashAlgorithm.HashCore(data, offset, count); byte[] hashValue = hashAlgorithm.HashFinal(); return VerifyHash(hashValue, signature); } }
public SHA384Cng() { Contract.Ensures(m_hashAlgorithm != null); m_hashAlgorithm = new BCryptHashAlgorithm(CngAlgorithm.Sha384, BCryptNative.ProviderName.MicrosoftPrimitiveProvider); }
public byte[] SignData(byte[] data, int offset, int count) { Contract.Ensures(Contract.Result<byte[]>() != null); if (data == null) { throw new ArgumentNullException("data"); } if (offset < 0 || offset > data.Length) { throw new ArgumentOutOfRangeException("offset"); } if (count < 0 || count > data.Length - offset) { throw new ArgumentOutOfRangeException("count"); } using (BCryptHashAlgorithm hashAlgorithm = new BCryptHashAlgorithm(HashAlgorithm, BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hashAlgorithm.HashCore(data, offset, count); byte[] hashValue = hashAlgorithm.HashFinal(); return SignHash(hashValue); } }
public bool VerifyData(Stream data, byte[] signature) { if (data == null) { throw new ArgumentNullException("data"); } if (signature == null) { throw new ArgumentNullException("signature"); } using (BCryptHashAlgorithm algorithm = new BCryptHashAlgorithm(this.HashAlgorithm, "Microsoft Primitive Provider")) { algorithm.HashStream(data); byte[] hash = algorithm.HashFinal(); return this.VerifyHash(hash, signature); } }
public bool VerifyData(byte[] data, int offset, int count, byte[] signature) { if (data == null) { throw new ArgumentNullException("data"); } if ((offset < 0) || (offset > data.Length)) { throw new ArgumentOutOfRangeException("offset"); } if ((count < 0) || (count > (data.Length - offset))) { throw new ArgumentOutOfRangeException("count"); } if (signature == null) { throw new ArgumentNullException("signature"); } using (BCryptHashAlgorithm algorithm = new BCryptHashAlgorithm(this.HashAlgorithm, "Microsoft Primitive Provider")) { algorithm.HashCore(data, offset, count); byte[] hash = algorithm.HashFinal(); return this.VerifyHash(hash, signature); } }
public byte[] SignData(Stream data) { if (data == null) { throw new ArgumentNullException("data"); } using (BCryptHashAlgorithm algorithm = new BCryptHashAlgorithm(this.HashAlgorithm, "Microsoft Primitive Provider")) { algorithm.HashStream(data); byte[] hash = algorithm.HashFinal(); return this.SignHash(hash); } }
protected override byte[] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) { // we're sealed and the base should have checked this already Debug.Assert(data != null); Debug.Assert(offset >= 0 && offset <= data.Length); Debug.Assert(count >= 0 && count <= data.Length); Debug.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name)); using (BCryptHashAlgorithm hasher = new BCryptHashAlgorithm(new CngAlgorithm(hashAlgorithm.Name), BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hasher.HashCore(data, offset, count); return hasher.HashFinal(); } }
protected override byte[] HashData(Stream data, HashAlgorithmName hashAlgorithm) { // We're sealed and the base should have checked these alread. Debug.Assert(data != null); Debug.Assert(!String.IsNullOrEmpty(hashAlgorithm.Name)); using (BCryptHashAlgorithm hasher = new BCryptHashAlgorithm(new CngAlgorithm(hashAlgorithm.Name), BCryptNative.ProviderName.MicrosoftPrimitiveProvider)) { hasher.HashStream(data); return hasher.HashFinal(); } }