Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SignHash()

byte[] System.Security.Cryptography.DSACryptoServiceProvider.SignHash ( byte[] rgbHash,
string? str )
inline

Definition at line 323 of file DSACryptoServiceProvider.cs.

324 {
325 if (rgbHash == null)
326 {
327 throw new ArgumentNullException("rgbHash");
328 }
329 if (PublicOnly)
330 {
331 throw new CryptographicException(System.SR.Cryptography_CSP_NoPrivateKey);
332 }
333 int calgHash = CapiHelper.NameOrOidToHashAlgId(str, OidGroup.HashAlgorithm);
334 if (rgbHash.Length != _sha1.HashSize / 8)
335 {
336 throw new CryptographicException(System.SR.Format(System.SR.Cryptography_InvalidHashSize, "SHA1", _sha1.HashSize / 8));
337 }
338 return CapiHelper.SignValue(SafeProvHandle, SafeKeyHandle, _parameters.KeyNumber, 8704, calgHash, rgbHash);
339 }
static int NameOrOidToHashAlgId(string nameOrOid, OidGroup oidGroup)
static byte[] SignValue(SafeProvHandle hProv, SafeKeyHandle hKey, int keyNumber, int calgKey, int calgHash, byte[] hash)
static string Cryptography_InvalidHashSize
Definition SR.cs:32
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Cryptography_CSP_NoPrivateKey
Definition SR.cs:48
Definition SR.cs:7

References System.Security.Cryptography.DSACryptoServiceProvider._parameters, System.Security.Cryptography.DSACryptoServiceProvider._sha1, System.SR.Cryptography_CSP_NoPrivateKey, System.SR.Cryptography_InvalidHashSize, System.SR.Format(), System.Security.Cryptography.HashAlgorithm.HashSize, System.Security.Cryptography.CspParameters.KeyNumber, Internal.NativeCrypto.CapiHelper.NameOrOidToHashAlgId(), System.Security.Cryptography.DSACryptoServiceProvider.PublicOnly, Internal.NativeCrypto.CapiHelper.SignValue(), and System.str.

Referenced by System.Security.Cryptography.DSACryptoServiceProvider.CreateSignature(), System.Security.Cryptography.DSACryptoServiceProvider.SignData(), System.Security.Cryptography.DSACryptoServiceProvider.SignData(), and System.Security.Cryptography.DSACryptoServiceProvider.SignData().