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

◆ GetSignatureAlgorithmIdentifier()

override byte[] System.Security.Cryptography.X509Certificates.RSAPkcs1X509SignatureGenerator.GetSignatureAlgorithmIdentifier ( HashAlgorithmName hashAlgorithm)
inline

Definition at line 33 of file RSAPkcs1X509SignatureGenerator.cs.

34 {
35 string oidValue;
36 if (hashAlgorithm == HashAlgorithmName.SHA256)
37 {
38 oidValue = "1.2.840.113549.1.1.11";
39 }
40 else if (hashAlgorithm == HashAlgorithmName.SHA384)
41 {
42 oidValue = "1.2.840.113549.1.1.12";
43 }
44 else
45 {
46 if (!(hashAlgorithm == HashAlgorithmName.SHA512))
47 {
48 throw new ArgumentOutOfRangeException("hashAlgorithm", hashAlgorithm, System.SR.Format(System.SR.Cryptography_UnknownHashAlgorithm, hashAlgorithm.Name));
49 }
50 oidValue = "1.2.840.113549.1.1.13";
51 }
52 AsnWriter asnWriter = new AsnWriter(AsnEncodingRules.DER);
53 asnWriter.PushSequence();
54 asnWriter.WriteObjectIdentifier(oidValue);
55 asnWriter.WriteNull();
56 asnWriter.PopSequence();
57 return asnWriter.Encode();
58 }
void WriteObjectIdentifier(string oidValue, Asn1Tag? tag=null)
Definition AsnWriter.cs:954
Scope PushSequence(Asn1Tag? tag=null)
int Encode(Span< byte > destination)
Definition AsnWriter.cs:195
void WriteNull(Asn1Tag? tag=null)
Definition AsnWriter.cs:880
void PopSequence(Asn1Tag? tag=null)
static string Cryptography_UnknownHashAlgorithm
Definition SR.cs:152
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7

References System.SR.Cryptography_UnknownHashAlgorithm, System.Formats.Asn1.AsnWriter.Encode(), System.SR.Format(), System.Security.Cryptography.HashAlgorithmName.Name, System.Formats.Asn1.AsnWriter.PopSequence(), System.Formats.Asn1.AsnWriter.PushSequence(), System.Security.Cryptography.HashAlgorithmName.SHA256, System.Security.Cryptography.HashAlgorithmName.SHA384, System.Security.Cryptography.HashAlgorithmName.SHA512, System.Formats.Asn1.AsnWriter.WriteNull(), and System.Formats.Asn1.AsnWriter.WriteObjectIdentifier().