Skip to content

Commit 6b2a3a7

Browse files
committed
minor refactor of Hkdf to HKdf
1 parent a1a64b4 commit 6b2a3a7

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

crypto/src/crypto/generators/HKDFBytesGenerator.cs renamed to crypto/src/crypto/generators/HKdfBytesGenerator.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Org.BouncyCastle.Crypto.Generators
1313
* (output keying material) and is likely to have better security properties
1414
* than KDF's based on just a hash function.
1515
*/
16-
public class HkdfBytesGenerator
16+
public class HKdfBytesGenerator
1717
: IDerivationFunction
1818
{
1919
private HMac hMacHash;
@@ -29,18 +29,18 @@ public class HkdfBytesGenerator
2929
*
3030
* @param hash the digest to be used as the source of generatedBytes bytes
3131
*/
32-
public HkdfBytesGenerator(IDigest hash)
32+
public HKdfBytesGenerator(IDigest hash)
3333
{
3434
this.hMacHash = new HMac(hash);
3535
this.hashLen = hash.GetDigestSize();
3636
}
3737

3838
public virtual void Init(IDerivationParameters parameters)
3939
{
40-
if (!(parameters is HkdfParameters))
41-
throw new ArgumentException("HKDF parameters required for HkdfBytesGenerator", "parameters");
40+
if (!(parameters is HKdfParameters))
41+
throw new ArgumentException("HKDF parameters required for HKdfBytesGenerator", "parameters");
4242

43-
HkdfParameters hkdfParameters = (HkdfParameters)parameters;
43+
HKdfParameters hkdfParameters = (HKdfParameters)parameters;
4444
if (hkdfParameters.SkipExtract)
4545
{
4646
// use IKM directly as PRK

crypto/src/crypto/parameters/HKDFParameters.cs renamed to crypto/src/crypto/parameters/HKdfParameters.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
namespace Org.BouncyCastle.Crypto.Parameters
77
{
88
/**
9-
* Parameter class for the HkdfBytesGenerator class.
9+
* Parameter class for the HKdfBytesGenerator class.
1010
*/
11-
public class HkdfParameters
11+
public class HKdfParameters
1212
: IDerivationParameters
1313
{
1414
private readonly byte[] ikm;
1515
private readonly bool skipExpand;
1616
private readonly byte[] salt;
1717
private readonly byte[] info;
1818

19-
private HkdfParameters(byte[] ikm, bool skip, byte[] salt, byte[] info)
19+
private HKdfParameters(byte[] ikm, bool skip, byte[] salt, byte[] info)
2020
{
2121
if (ikm == null)
2222
throw new ArgumentNullException("ikm");
@@ -51,7 +51,7 @@ private HkdfParameters(byte[] ikm, bool skip, byte[] salt, byte[] info)
5151
* @param salt the salt to use, may be null for a salt for hashLen zeros
5252
* @param info the info to use, may be null for an info field of zero bytes
5353
*/
54-
public HkdfParameters(byte[] ikm, byte[] salt, byte[] info)
54+
public HKdfParameters(byte[] ikm, byte[] salt, byte[] info)
5555
: this(ikm, false, salt, info)
5656
{
5757
}
@@ -65,14 +65,14 @@ public HkdfParameters(byte[] ikm, byte[] salt, byte[] info)
6565
* @param info the info to use, may be null for an info field of zero bytes
6666
* @return HKDFParameters that makes the implementation skip step 1
6767
*/
68-
public static HkdfParameters SkipExtractParameters(byte[] ikm, byte[] info)
68+
public static HKdfParameters SkipExtractParameters(byte[] ikm, byte[] info)
6969
{
70-
return new HkdfParameters(ikm, true, null, info);
70+
return new HKdfParameters(ikm, true, null, info);
7171
}
7272

73-
public static HkdfParameters DefaultParameters(byte[] ikm)
73+
public static HKdfParameters DefaultParameters(byte[] ikm)
7474
{
75-
return new HkdfParameters(ikm, false, null, null);
75+
return new HKdfParameters(ikm, false, null, null);
7676
}
7777

7878
/**

0 commit comments

Comments
 (0)