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

◆ DecryptPkcs8() [6/6]

static ArraySegment< byte > System.Security.Cryptography.KeyFormatHelper.DecryptPkcs8 ( ReadOnlySpan< char > inputPassword,
ReadOnlySpan< byte > inputPasswordBytes,
ReadOnlyMemory< byte > source,
out int bytesRead )
inlinestaticprivate

Definition at line 76 of file KeyFormatHelper.cs.

77 {
78 int length;
80 try
81 {
85 }
86 catch (AsnContentException inner)
87 {
88 throw new CryptographicException(System.SR.Cryptography_Der_Invalid_Encoding, inner);
89 }
91 try
92 {
93 int count = System.Security.Cryptography.PasswordBasedEncryption.Decrypt(in decoded.EncryptionAlgorithm, inputPassword, inputPasswordBytes, decoded.EncryptedData.Span, array);
94 bytesRead = length;
95 return new ArraySegment<byte>(array, 0, count);
96 }
97 catch (CryptographicException inner2)
98 {
100 throw new CryptographicException(System.SR.Cryptography_Pkcs8_EncryptedReadFailed, inner2);
101 }
102 }
static string Cryptography_Der_Invalid_Encoding
Definition SR.cs:50
static string Cryptography_Pkcs8_EncryptedReadFailed
Definition SR.cs:126
Definition SR.cs:7
static void Return(byte[] array, int clearSize=-1)
Definition CryptoPool.cs:12
static byte[] Rent(int minimumLength)
Definition CryptoPool.cs:7
static unsafe int Decrypt(in AlgorithmIdentifierAsn algorithmIdentifier, ReadOnlySpan< char > password, ReadOnlySpan< byte > passwordBytes, ReadOnlySpan< byte > encryptedData, Span< byte > destination)
ReadOnlySpan< byte > PeekEncodedValue()
unsafe ReadOnlySpan< T > Span
static void Decode(ref AsnValueReader reader, ReadOnlyMemory< byte > rebind, out EncryptedPrivateKeyInfoAsn decoded)

References System.array, System.count, System.SR.Cryptography_Der_Invalid_Encoding, System.SR.Cryptography_Pkcs8_EncryptedReadFailed, System.Security.Cryptography.Asn1.EncryptedPrivateKeyInfoAsn.Decode(), System.Security.Cryptography.PasswordBasedEncryption.Decrypt(), System.Security.Cryptography.Asn1.EncryptedPrivateKeyInfoAsn.EncryptedData, System.Security.Cryptography.Asn1.EncryptedPrivateKeyInfoAsn.EncryptionAlgorithm, System.length, System.ReadOnlyMemory< T >.Length, System.ReadOnlySpan< T >.Length, System.Formats.Asn1.AsnValueReader.PeekEncodedValue(), System.Security.Cryptography.CryptoPool.Rent(), System.Security.Cryptography.CryptoPool.Return(), System.source, and System.ReadOnlyMemory< T >.Span.