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

◆ DecodePublicKey()

AsymmetricAlgorithm Internal.Cryptography.Pal.X509Pal.DecodePublicKey ( Oid oid,
byte[] encodedKeyValue,
byte[] encodedParameters,
ICertificatePal certificatePal )
inline

Implements Internal.Cryptography.Pal.IX509Pal.

Definition at line 229 of file X509Pal.cs.

230 {
231 switch (global::Interop.Crypt32.FindOidInfo(global::Interop.Crypt32.CryptOidInfoKeyType.CRYPT_OID_INFO_OID_KEY, oid.Value, OidGroup.PublicKeyAlgorithm, fallBackToAllGroups: true).AlgId)
232 {
233 case 9216:
234 case 41984:
235 {
236 byte[] keyBlob2 = DecodeKeyBlob(CryptDecodeObjectStructType.CNG_RSA_PUBLIC_KEY_BLOB, encodedKeyValue);
238 return new RSACng(key);
239 }
240 case 8704:
241 {
242 byte[] keyBlob = ConstructDSSPublicKeyCspBlob(encodedKeyValue, encodedParameters);
243 DSACryptoServiceProvider dSACryptoServiceProvider = new DSACryptoServiceProvider();
244 dSACryptoServiceProvider.ImportCspBlob(keyBlob);
245 return dSACryptoServiceProvider;
246 }
247 default:
249 }
250 }
static byte[] ConstructDSSPublicKeyCspBlob(byte[] encodedKeyValue, byte[] encodedParameters)
Definition X509Pal.cs:352
static byte[] DecodeKeyBlob(CryptDecodeObjectStructType lpszStructType, byte[] encodedKeyValue)
Definition X509Pal.cs:337
static string NotSupported_KeyAlgorithm
Definition SR.cs:114
Definition SR.cs:7
static CngKey Import(ReadOnlySpan< byte > keyBlob, CngKeyBlobFormat format)
Definition CngKey.cs:525

References Internal.Cryptography.Pal.X509Pal.ConstructDSSPublicKeyCspBlob(), Internal.Cryptography.Pal.X509Pal.DecodeKeyBlob(), System.Security.Cryptography.CngKeyBlobFormat.GenericPublicBlob, System.Security.Cryptography.CngKey.Import(), System.Security.Cryptography.DSACryptoServiceProvider.ImportCspBlob(), System.key, System.SR.NotSupported_KeyAlgorithm, and System.Security.Cryptography.Oid.Value.