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

◆ ReencryptPkcs8() [2/4]

static AsnWriter System.Security.Cryptography.KeyFormatHelper.ReencryptPkcs8 ( ReadOnlySpan< char > inputPassword,
ReadOnlyMemory< byte > current,
ReadOnlySpan< byte > newPasswordBytes,
PbeParameters pbeParameters )
inlinestaticpackage

Definition at line 128 of file KeyFormatHelper.cs.

129 {
130 int bytesRead;
131 ArraySegment<byte> arraySegment = DecryptPkcs8(inputPassword, current, out bytesRead);
132 try
133 {
134 if (bytesRead != current.Length)
135 {
136 throw new CryptographicException(System.SR.Cryptography_Der_Invalid_Encoding);
137 }
138 AsnWriter asnWriter = new AsnWriter(AsnEncodingRules.BER);
139 asnWriter.WriteEncodedValueForCrypto(arraySegment);
140 return WriteEncryptedPkcs8(newPasswordBytes, asnWriter, pbeParameters);
141 }
142 catch (CryptographicException inner)
143 {
144 throw new CryptographicException(System.SR.Cryptography_Pkcs8_EncryptedReadFailed, inner);
145 }
146 finally
147 {
149 }
150 }
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 ArraySegment< byte > DecryptPkcs8(ReadOnlySpan< char > inputPassword, ReadOnlyMemory< byte > source, out int bytesRead)
static AsnWriter WriteEncryptedPkcs8(ReadOnlySpan< char > password, AsnWriter pkcs8Writer, PbeParameters pbeParameters)

References System.SR.Cryptography_Der_Invalid_Encoding, System.SR.Cryptography_Pkcs8_EncryptedReadFailed, System.Security.Cryptography.KeyFormatHelper.DecryptPkcs8(), System.ReadOnlyMemory< T >.Length, System.Security.Cryptography.CryptoPool.Return(), and System.Security.Cryptography.KeyFormatHelper.WriteEncryptedPkcs8().