83 references to KeyDerivationPrf
Microsoft.AspNetCore.Cryptography.KeyDerivation (28)
KeyDerivation.cs (3)
28
public static byte[] Pbkdf2(string password, byte[] salt,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested)
34
if (prf <
KeyDerivationPrf
.HMACSHA1 || prf >
KeyDerivationPrf
.HMACSHA512)
PBKDF2\IPbkdf2Provider.cs (1)
11
byte[] DeriveKey(string password, byte[] salt,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested);
PBKDF2\ManagedPbkdf2Provider.cs (5)
17
public byte[] DeriveKey(string password, byte[] salt,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested)
69
private static KeyedHashAlgorithm PrfToManagedHmacAlgorithm(
KeyDerivationPrf
prf, string password)
76
case
KeyDerivationPrf
.HMACSHA1:
78
case
KeyDerivationPrf
.HMACSHA256:
80
case
KeyDerivationPrf
.HMACSHA512:
PBKDF2\NetCorePbkdf2Provider.cs (4)
17
public byte[] DeriveKey(string password, byte[] salt,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested)
27
case
KeyDerivationPrf
.HMACSHA1:
30
case
KeyDerivationPrf
.HMACSHA256:
33
case
KeyDerivationPrf
.HMACSHA512:
PBKDF2\Win7Pbkdf2Provider.cs (5)
16
public byte[] DeriveKey(string password, byte[] salt,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested)
84
private static BCryptAlgorithmHandle PrfToCachedCngAlgorithmInstance(
KeyDerivationPrf
prf)
88
case
KeyDerivationPrf
.HMACSHA1:
90
case
KeyDerivationPrf
.HMACSHA256:
92
case
KeyDerivationPrf
.HMACSHA512:
PBKDF2\Win8Pbkdf2Provider.cs (10)
18
public byte[] DeriveKey(string password, byte[] salt,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested)
58
private static BCryptKeyHandle PasswordToPbkdfKeyHandle(string password, BCryptAlgorithmHandle pbkdf2AlgHandle,
KeyDerivationPrf
prf)
98
private static BCryptKeyHandle PasswordToPbkdfKeyHandleStep2(BCryptAlgorithmHandle pbkdf2AlgHandle, byte* pbPassword, uint cbPassword,
KeyDerivationPrf
prf)
115
case
KeyDerivationPrf
.HMACSHA1:
118
case
KeyDerivationPrf
.HMACSHA256:
121
case
KeyDerivationPrf
.HMACSHA512:
196
private static string PrfToCngAlgorithmId(
KeyDerivationPrf
prf)
200
case
KeyDerivationPrf
.HMACSHA1:
202
case
KeyDerivationPrf
.HMACSHA256:
204
case
KeyDerivationPrf
.HMACSHA512:
Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests (43)
Pbkdf2Tests.cs (43)
21
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 - 1, "efmxNcKD/U1urTEDGvsThlPnHA==")]
22
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 + 0, "efmxNcKD/U1urTEDGvsThlPnHDI=")]
23
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 + 1, "efmxNcKD/U1urTEDGvsThlPnHDLk")]
24
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 - 1, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRA==")]
25
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 + 0, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRLo=")]
26
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 + 1, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRLpk")]
27
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 - 1, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm9")]
28
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 + 0, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm90Q==")]
29
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 + 1, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm90Wk=")]
30
public void RunTest_Normal_NetCore(string password,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested, string expectedValueAsBase64)
84
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 - 1, "efmxNcKD/U1urTEDGvsThlPnHA==")]
85
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 + 0, "efmxNcKD/U1urTEDGvsThlPnHDI=")]
86
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 + 1, "efmxNcKD/U1urTEDGvsThlPnHDLk")]
87
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 - 1, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRA==")]
88
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 + 0, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRLo=")]
89
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 + 1, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRLpk")]
90
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 - 1, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm9")]
91
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 + 0, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm90Q==")]
92
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 + 1, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm90Wk=")]
93
public void RunTest_Normal_Managed(string password,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested, string expectedValueAsBase64)
111
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 - 1, "efmxNcKD/U1urTEDGvsThlPnHA==")]
112
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 + 0, "efmxNcKD/U1urTEDGvsThlPnHDI=")]
113
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 + 1, "efmxNcKD/U1urTEDGvsThlPnHDLk")]
114
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 - 1, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRA==")]
115
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 + 0, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRLo=")]
116
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 + 1, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRLpk")]
117
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 - 1, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm9")]
118
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 + 0, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm90Q==")]
119
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 + 1, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm90Wk=")]
120
public void RunTest_Normal_Win7(string password,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested, string expectedValueAsBase64)
138
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 - 1, "efmxNcKD/U1urTEDGvsThlPnHA==")]
139
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 + 0, "efmxNcKD/U1urTEDGvsThlPnHDI=")]
140
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA1, 5, 160 / 8 + 1, "efmxNcKD/U1urTEDGvsThlPnHDLk")]
141
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 - 1, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRA==")]
142
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 + 0, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRLo=")]
143
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA256, 5, 256 / 8 + 1, "JRNz8bPKS02EG1vf7eWjA64IeeI+TI8gBEwb1oVvRLpk")]
144
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 - 1, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm9")]
145
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 + 0, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm90Q==")]
146
[InlineData("my-password",
KeyDerivationPrf
.HMACSHA512, 5, 512 / 8 + 1, "ZTallQJrFn0279xIzaiA1XqatVTGei+ZjKngA7bIMtKMDUw6YJeGUQpFG8iGTgN+ri3LNDktNbzwfcSyZmm90Wk=")]
147
public void RunTest_Normal_Win8(string password,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested, string expectedValueAsBase64)
193
const
KeyDerivationPrf
prf =
KeyDerivationPrf
.HMACSHA256;
201
private static void TestProvider<TProvider>(string password, byte[] salt,
KeyDerivationPrf
prf, int iterationCount, int numBytesRequested, string expectedDerivedKeyAsBase64)
Microsoft.Extensions.Identity.Core (12)
PasswordHasher.cs (12)
115
const
KeyDerivationPrf
Pbkdf2Prf =
KeyDerivationPrf
.HMACSHA1; // default for Rfc2898DeriveBytes
135
prf:
KeyDerivationPrf
.HMACSHA512,
141
private static byte[] HashPasswordV3(string password, RandomNumberGenerator rng,
KeyDerivationPrf
prf, int iterCount, int saltSize, int numBytesRequested)
194
if (VerifyHashedPasswordV3(decodedHashedPassword, providedPassword, out int embeddedIterCount, out
KeyDerivationPrf
prf))
203
if (prf ==
KeyDerivationPrf
.HMACSHA1 || prf ==
KeyDerivationPrf
.HMACSHA256)
222
const
KeyDerivationPrf
Pbkdf2Prf =
KeyDerivationPrf
.HMACSHA1; // default for Rfc2898DeriveBytes
250
private static bool VerifyHashedPasswordV3(byte[] hashedPassword, string password, out int iterCount, out
KeyDerivationPrf
prf)
253
prf = default(
KeyDerivationPrf
);
258
prf = (
KeyDerivationPrf
)ReadNetworkByteOrder(hashedPassword, 1);