29 instantiations of Secret
Microsoft.AspNetCore.DataProtection (12)
AuthenticatedEncryption\CngCbcAuthenticatedEncryptorFactory.cs (1)
58
using var key = new
Secret
(secret);
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactory.cs (1)
60
using var key = new
Secret
(secret);
AuthenticatedEncryption\ConfigurationModel\SecretExtensions.cs (1)
55
return new
Secret
(unprotectedSecret);
AuthenticatedEncryption\ManagedAuthenticatedEncryptorFactory.cs (1)
52
keyDerivationKey: new
Secret
(secret),
Cng\DpapiSecretSerializerHelper.cs (3)
33
using var secret = new
Secret
((byte*)&dummy, sizeof(Guid));
245
return new
Secret
(dataOut.pbData, checked((int)dataOut.cbData));
307
return new
Secret
((byte*)unencryptedPayloadHandle.DangerousGetHandle(), checked((int)cbUnencryptedPayload));
Managed\AesGcmAuthenticatedEncryptor.cs (1)
48
_keyDerivationKey = new
Secret
(keyDerivationKey);
Secret.cs (3)
175
return new
Secret
(&dummy, 0);
182
return new
Secret
(ManagedGenRandomImpl.Instance.GenRandom(numBytes));
191
return new
Secret
(pbBytes, numBytes);
XmlEncryption\XmlEncryptionExtensions.cs (1)
172
return new
Secret
(new ArraySegment<byte>(underlyingBuffer, 0, checked((int)memoryStream.Length)));
Microsoft.AspNetCore.DataProtection.Tests (17)
Cng\CbcAuthenticatedEncryptorTests.cs (3)
19
Secret kdk = new
Secret
(new byte[512 / 8]);
40
Secret kdk = new
Secret
(new byte[512 / 8]);
87
Secret kdk = new
Secret
(Encoding.UTF8.GetBytes("master key"));
Cng\GcmAuthenticatedEncryptorTests.cs (3)
19
Secret kdk = new
Secret
(new byte[512 / 8]);
37
Secret kdk = new
Secret
(new byte[512 / 8]);
81
Secret kdk = new
Secret
(Encoding.UTF8.GetBytes("master key"));
Managed\ManagedAuthenticatedEncryptorTests.cs (3)
15
Secret kdk = new
Secret
(new byte[512 / 8]);
35
Secret kdk = new
Secret
(new byte[512 / 8]);
81
Secret kdk = new
Secret
(Encoding.UTF8.GetBytes("master key"));
SecretTests.cs (8)
15
testCode: () => new
Secret
(default(ArraySegment<byte>)),
27
var secret = new
Secret
(input);
54
var secret = new
Secret
(input);
78
var secret = new
Secret
(new byte[0]);
92
testCode: () => new
Secret
(null, 0),
104
new
Secret
(&dummy, -1);
117
var secret = new
Secret
(&input, 0);
136
var secret = new
Secret
(input, 3);
81 references to Secret
Microsoft.AspNetCore.DataProtection (43)
AuthenticatedEncryption\CngCbcAuthenticatedEncryptorFactory.cs (1)
58
using
var
key = new Secret(secret);
AuthenticatedEncryption\CngGcmAuthenticatedEncryptorFactory.cs (1)
60
using
var
key = new Secret(secret);
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorConfiguration.cs (3)
35
return internalConfiguration.CreateDescriptorFromSecret(
Secret
.Random(KDK_SIZE_IN_BYTES));
47
using
var
secret =
Secret
.Random(512 / 8);
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializer.cs (1)
43
Secret
masterKey = ((string)element.Elements("masterKey").Single()).ToSecret();
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorConfiguration.cs (3)
80
return internalConfiguration.CreateDescriptorFromSecret(
Secret
.Random(KDK_SIZE_IN_BYTES));
97
using
var
secret =
Secret
.Random(512 / 8);
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptorDeserializer.cs (1)
44
Secret
masterKey = ((string)element.Element("masterKey"))!.ToSecret();
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorConfiguration.cs (3)
56
return internalConfiguration.CreateDescriptorFromSecret(
Secret
.Random(KDK_SIZE_IN_BYTES));
73
using
var
secret =
Secret
.Random(512 / 8);
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptorDeserializer.cs (1)
39
Secret
masterKey = ((string)element.Element("masterKey")!).ToSecret();
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorConfiguration.cs (3)
59
return internalConfiguration.CreateDescriptorFromSecret(
Secret
.Random(KDK_SIZE_IN_BYTES));
76
using
var
secret =
Secret
.Random(512 / 8);
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptorDeserializer.cs (1)
41
Secret
masterKey = ((string)element.Element("masterKey")!).ToSecret();
AuthenticatedEncryption\ConfigurationModel\SecretExtensions.cs (2)
47
/// <returns>The <see cref="
Secret
"/>.</returns>
48
public static
Secret
ToSecret(this string base64String)
Cng\CbcAuthenticatedEncryptor.cs (1)
40
public CbcAuthenticatedEncryptor(
Secret
keyDerivationKey, BCryptAlgorithmHandle symmetricAlgorithmHandle, uint symmetricAlgorithmKeySizeInBytes, BCryptAlgorithmHandle hmacAlgorithmHandle, IBCryptGenRandom? genRandom = null)
Cng\CngGcmAuthenticatedEncryptor.cs (1)
40
public CngGcmAuthenticatedEncryptor(
Secret
keyDerivationKey, BCryptAlgorithmHandle symmetricAlgorithmHandle, uint symmetricAlgorithmKeySizeInBytes, IBCryptGenRandom? genRandom = null)
Cng\DpapiSecretSerializerHelper.cs (5)
33
using
var
secret = new Secret((byte*)&dummy, sizeof(Guid));
196
public static
Secret
UnprotectWithDpapi(byte[] protectedSecret)
209
internal static
Secret
UnprotectWithDpapiCore(byte* pbProtectedData, uint cbProtectedData, byte* pbOptionalEntropy, uint cbOptionalEntropy)
259
public static
Secret
UnprotectWithDpapiNG(byte[] protectedData)
272
private static
Secret
UnprotectWithDpapiNGCore(byte* pbData, uint cbData)
KeyManagement\Key.cs (1)
227
var
encryptedKeyElement = keyElement.ToSecret();
Managed\AesGcmAuthenticatedEncryptor.cs (1)
42
private readonly
Secret
_keyDerivationKey;
Managed\ManagedAuthenticatedEncryptor.cs (2)
33
private readonly
Secret
_keyDerivationKey;
41
public ManagedAuthenticatedEncryptor(
Secret
keyDerivationKey, Func<SymmetricAlgorithm> symmetricAlgorithmFactory, int symmetricAlgorithmKeySizeInBytes, Func<KeyedHashAlgorithm> validationAlgorithmFactory, IManagedGenRandom? genRandom = null)
Secret.cs (3)
72
var
other = secret as
Secret
;
165
public static
Secret
Random(int numBytes)
SP800_108\SP800_108_CTR_HMACSHA512Util.cs (1)
39
public static ISP800_108_CTR_HMACSHA512Provider CreateProvider(
Secret
kdk)
XmlEncryption\DpapiNGXmlDecryptor.cs (1)
75
using (
var
secret = DpapiSecretSerializerHelper.UnprotectWithDpapiNG(protectedSecret))
XmlEncryption\DpapiNGXmlEncryptor.cs (1)
68
using (
var
plaintextElementAsSecret = plaintextElement.ToSecret())
XmlEncryption\DpapiXmlDecryptor.cs (1)
58
using (
var
secret = DpapiSecretSerializerHelper.UnprotectWithDpapi(protectedSecret))
XmlEncryption\DpapiXmlEncryptor.cs (1)
66
using (
var
plaintextElementAsSecret = plaintextElement.ToSecret())
XmlEncryption\XmlEncryptionExtensions.cs (4)
158
/// Converts an <see cref="XElement"/> to a <see cref="
Secret
"/> so that it can be kept in memory
161
public static
Secret
ToSecret(this XElement element)
182
/// Converts a <see cref="
Secret
"/> back into an <see cref="XElement"/>.
184
public static XElement ToXElement(this
Secret
secret)
Microsoft.AspNetCore.DataProtection.Tests (38)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorTests.cs (8)
36
var
masterKey =
Secret
.Random(512 / 8);
63
var
masterKey =
Secret
.Random(512 / 8);
89
var
masterKey =
Secret
.Random(512 / 8);
126
var
masterKey =
Secret
.Random(512 / 8);
Cng\CbcAuthenticatedEncryptorTests.cs (3)
19
Secret
kdk = new Secret(new byte[512 / 8]);
40
Secret
kdk = new Secret(new byte[512 / 8]);
87
Secret
kdk = new Secret(Encoding.UTF8.GetBytes("master key"));
Cng\GcmAuthenticatedEncryptorTests.cs (3)
19
Secret
kdk = new Secret(new byte[512 / 8]);
37
Secret
kdk = new Secret(new byte[512 / 8]);
81
Secret
kdk = new Secret(Encoding.UTF8.GetBytes("master key"));
Managed\ManagedAuthenticatedEncryptorTests.cs (3)
15
Secret
kdk = new Secret(new byte[512 / 8]);
35
Secret
kdk = new Secret(new byte[512 / 8]);
81
Secret
kdk = new Secret(Encoding.UTF8.GetBytes("master key"));
SecretTests.cs (21)
27
var
secret = new Secret(input);
54
var
secret = new Secret(input);
78
var
secret = new Secret(new byte[0]);
117
var
secret = new Secret(&input, 0);
136
var
secret = new Secret(input, 3);
160
var
secret =
Secret
.Random(0);
170
var
secret =
Secret
.Random(32);
185
var
secret =
Secret
.Random(31);
201
var
secret =
Secret
.Random(16);
214
var
secret =
Secret
.Random(16);
226
var
secret =
Secret
.Random(16);
238
var
secret =
Secret
.Random(16);
255
var
secret =
Secret
.Random(16);