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

◆ GenerateSubjectKeyIdentifierFromPublicKey()

static byte[] System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension.GenerateSubjectKeyIdentifierFromPublicKey ( PublicKey key,
X509SubjectKeyIdentifierHashAlgorithm algorithm )
inlinestaticprivate

Definition at line 98 of file X509SubjectKeyIdentifierExtension.cs.

99 {
100 switch (algorithm)
101 {
103 return SHA1.HashData(key.EncodedKeyValue.RawData);
105 {
106 byte[] array = SHA1.HashData(key.EncodedKeyValue.RawData);
107 byte[] array2 = new byte[8];
108 Buffer.BlockCopy(array, array.Length - 8, array2, 0, array2.Length);
109 array2[0] &= 15;
110 array2[0] |= 64;
111 return array2;
112 }
114 return X509Pal.Instance.ComputeCapiSha1OfPublicKey(key);
115 default:
116 throw new ArgumentException(System.SR.Format(System.SR.Arg_EnumIllegalVal, algorithm), "algorithm");
117 }
118 }
static string Arg_EnumIllegalVal
Definition SR.cs:144
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7

References System.SR.Arg_EnumIllegalVal, System.array, System.Buffer.BlockCopy(), System.SR.Format(), System.Security.Cryptography.SHA1.HashData(), Internal.Cryptography.Pal.X509Pal.Instance, and System.key.

Referenced by System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension.EncodeExtension().