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

◆ GenerateV1DsaBlob()

static unsafe void System.Security.Cryptography.DSACng.GenerateV1DsaBlob ( out byte[] blob,
DSAParameters parameters,
int cbKey,
bool includePrivate )
inlinestaticprivate

Definition at line 230 of file DSACng.cs.

231 {
232 int num = sizeof(global::Interop.BCrypt.BCRYPT_DSA_KEY_BLOB) + cbKey + cbKey + cbKey;
233 if (includePrivate)
234 {
235 num += 20;
236 }
237 blob = new byte[num];
238 fixed (byte* ptr = &blob[0])
239 {
240 global::Interop.BCrypt.BCRYPT_DSA_KEY_BLOB* ptr2 = (global::Interop.BCrypt.BCRYPT_DSA_KEY_BLOB*)ptr;
241 ptr2->Magic = (includePrivate ? global::Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_DSA_PRIVATE_MAGIC : global::Interop.BCrypt.KeyBlobMagicNumber.BCRYPT_DSA_PUBLIC_MAGIC);
242 ptr2->cbKey = cbKey;
243 int offset = 8;
244 if (parameters.Seed != null)
245 {
246 if (parameters.Seed.Length != 20)
247 {
249 }
250 global::Interop.BCrypt.EmitBigEndian(blob, ref offset, parameters.Counter);
251 global::Interop.BCrypt.Emit(blob, ref offset, parameters.Seed);
252 }
253 else
254 {
255 global::Interop.BCrypt.EmitByte(blob, ref offset, byte.MaxValue, 24);
256 }
257 if (parameters.Q.Length != 20)
258 {
260 }
261 global::Interop.BCrypt.Emit(blob, ref offset, parameters.Q);
262 global::Interop.BCrypt.Emit(blob, ref offset, parameters.P);
263 global::Interop.BCrypt.Emit(blob, ref offset, parameters.G);
264 global::Interop.BCrypt.Emit(blob, ref offset, parameters.Y);
265 if (includePrivate)
266 {
267 global::Interop.BCrypt.Emit(blob, ref offset, parameters.X);
268 }
269 }
270 }
static string Cryptography_InvalidDsaParameters_QRestriction_ShortKey
Definition SR.cs:80
static string Cryptography_InvalidDsaParameters_SeedRestriction_ShortKey
Definition SR.cs:78
Definition SR.cs:7

References System.Security.Cryptography.DSAParameters.Counter, System.SR.Cryptography_InvalidDsaParameters_QRestriction_ShortKey, System.SR.Cryptography_InvalidDsaParameters_SeedRestriction_ShortKey, System.Security.Cryptography.DSAParameters.G, System.offset, System.Security.Cryptography.DSAParameters.P, System.Security.Cryptography.DSAParameters.Q, System.Security.Cryptography.DSAParameters.Seed, System.Security.Cryptography.DSAParameters.X, and System.Security.Cryptography.DSAParameters.Y.

Referenced by System.Security.Cryptography.DSACng.ImportParameters().