HashAlgorithmNameNullOrEmpty() private static method

private static HashAlgorithmNameNullOrEmpty ( ) : Exception
return Exception
Beispiel #1
0
 public virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
 {
     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");
     }
     if (string.IsNullOrEmpty(hashAlgorithm.Name))
     {
         throw RSA.HashAlgorithmNameNullOrEmpty();
     }
     if (padding == (RSASignaturePadding)null)
     {
         throw new ArgumentNullException("padding");
     }
     return(this.VerifyHash(this.HashData(data, offset, count, hashAlgorithm), signature, hashAlgorithm, padding));
 }
 /// <summary>Computes the hash value of a portion of the specified byte array using the specified hash algorithm and padding mode, and signs the resulting hash value. </summary>
 /// <param name="data">The input data for which to compute the hash. </param>
 /// <param name="offset">The offset into the array at which to begin using data. </param>
 /// <param name="count">The number of bytes in the array to use as data. </param>
 /// <param name="hashAlgorithm">The hash algorithm to use to create the hash value. </param>
 /// <param name="padding">The padding mode. </param>
 /// <returns>The RSA signature for the specified data. </returns>
 /// <exception cref="T:System.ArgumentNullException">
 ///         <paramref name="data" /> is <see langword="null" />. -or-
 ///         <paramref name="padding" /> is <see langword="null" />. </exception>
 /// <exception cref="T:System.ArgumentException">
 ///         <paramref name="hashAlgorithm" />.<see cref="P:System.Security.Cryptography.HashAlgorithmName.Name" /> is <see langword="null" /> or <see cref="F:System.String.Empty" />. </exception>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///         <paramref name="offset" /> is less than zero. -or-
 ///         <paramref name="count" /> is less than zero. -or-
 ///         <paramref name="offset" /> + <paramref name="count" /> – 1 results in an index that is beyond the upper bound of <paramref name="data" />.  </exception>
 // Token: 0x06002288 RID: 8840 RVA: 0x0007C150 File Offset: 0x0007A350
 public virtual byte[] SignData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
 {
     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 (string.IsNullOrEmpty(hashAlgorithm.Name))
     {
         throw RSA.HashAlgorithmNameNullOrEmpty();
     }
     if (padding == null)
     {
         throw new ArgumentNullException("padding");
     }
     byte[] hash = this.HashData(data, offset, count, hashAlgorithm);
     return(this.SignHash(hash, hashAlgorithm, padding));
 }
Beispiel #3
0
 public virtual byte[] SignData(Stream data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (string.IsNullOrEmpty(hashAlgorithm.Name))
     {
         throw RSA.HashAlgorithmNameNullOrEmpty();
     }
     if (padding == (RSASignaturePadding)null)
     {
         throw new ArgumentNullException("padding");
     }
     return(this.SignHash(this.HashData(data, hashAlgorithm), hashAlgorithm, padding));
 }
 public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
 {
     if (hash == null)
     {
         throw new ArgumentNullException("hash");
     }
     if (string.IsNullOrEmpty(hashAlgorithm.Name))
     {
         throw RSA.HashAlgorithmNameNullOrEmpty();
     }
     if (padding == (RSASignaturePadding)null)
     {
         throw new ArgumentNullException("padding");
     }
     if (padding != RSASignaturePadding.Pkcs1)
     {
         throw RSACryptoServiceProvider.PaddingModeNotSupported();
     }
     return(this.SignHash(hash, RSACryptoServiceProvider.GetAlgorithmId(hashAlgorithm)));
 }
Beispiel #5
0
 public bool VerifyData(Stream data, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data");
     }
     if (signature == null)
     {
         throw new ArgumentNullException("signature");
     }
     if (string.IsNullOrEmpty(hashAlgorithm.Name))
     {
         throw RSA.HashAlgorithmNameNullOrEmpty();
     }
     if (padding == (RSASignaturePadding)null)
     {
         throw new ArgumentNullException("padding");
     }
     return(this.VerifyHash(this.HashData(data, hashAlgorithm), signature, hashAlgorithm, padding));
 }