diff --git a/crypto/src/cms/EnvelopedDataHelper.cs b/crypto/src/cms/EnvelopedDataHelper.cs
index 616048297..9dcfe033b 100644
--- a/crypto/src/cms/EnvelopedDataHelper.cs
+++ b/crypto/src/cms/EnvelopedDataHelper.cs
@@ -79,7 +79,7 @@ namespace Org.BouncyCastle.Cms
public AlgorithmIdentifier GenerateEncryptionAlgID(DerObjectIdentifier encryptionOID, KeyParameter encKey,
SecureRandom random)
{
- return AlgorithmIdentifierFactory.GenerateEncryptionAlgID(encryptionOID, encKey.GetKey().Length * 8, random);
+ return AlgorithmIdentifierFactory.GenerateEncryptionAlgID(encryptionOID, encKey.KeyLength * 8, random);
}
public CipherKeyGenerator CreateKeyGenerator(DerObjectIdentifier algorithm, SecureRandom random)
diff --git a/crypto/src/cms/KEKRecipientInfoGenerator.cs b/crypto/src/cms/KEKRecipientInfoGenerator.cs
index d8075d450..2b8524dc6 100644
--- a/crypto/src/cms/KEKRecipientInfoGenerator.cs
+++ b/crypto/src/cms/KEKRecipientInfoGenerator.cs
@@ -78,7 +78,7 @@ namespace Org.BouncyCastle.Cms
}
else if (Platform.StartsWith(algorithm, "AES"))
{
- int length = key.GetKey().Length * 8;
+ int length = key.KeyLength * 8;
DerObjectIdentifier wrapOid;
if (length == 128)
@@ -107,7 +107,7 @@ namespace Org.BouncyCastle.Cms
}
else if (Platform.StartsWith(algorithm, "CAMELLIA"))
{
- int length = key.GetKey().Length * 8;
+ int length = key.KeyLength * 8;
DerObjectIdentifier wrapOid;
if (length == 128)
diff --git a/crypto/src/crypto/modes/ChaCha20Poly1305.cs b/crypto/src/crypto/modes/ChaCha20Poly1305.cs
index dc56f4184..7e2348932 100644
--- a/crypto/src/crypto/modes/ChaCha20Poly1305.cs
+++ b/crypto/src/crypto/modes/ChaCha20Poly1305.cs
@@ -112,7 +112,7 @@ namespace Org.BouncyCastle.Crypto.Modes
}
else
{
- if (KeySize != initKeyParam.GetKey().Length)
+ if (KeySize != initKeyParam.KeyLength)
throw new ArgumentException("Key must be 256 bits");
}
diff --git a/crypto/src/crypto/modes/GcmSivBlockCipher.cs b/crypto/src/crypto/modes/GcmSivBlockCipher.cs
index a4fcdd759..e11411433 100644
--- a/crypto/src/crypto/modes/GcmSivBlockCipher.cs
+++ b/crypto/src/crypto/modes/GcmSivBlockCipher.cs
@@ -851,7 +851,7 @@ namespace Org.BouncyCastle.Crypto.Modes
byte[] myIn = new byte[BUFLEN];
byte[] myOut = new byte[BUFLEN];
byte[] myResult = new byte[BUFLEN];
- byte[] myEncKey = new byte[pKey.GetKey().Length];
+ byte[] myEncKey = new byte[pKey.KeyLength];
/* Prepare for encryption */
Array.Copy(theNonce, 0, myIn, BUFLEN - NONCELEN, NONCELEN);
diff --git a/crypto/src/crypto/operators/Asn1CipherBuilder.cs b/crypto/src/crypto/operators/Asn1CipherBuilder.cs
index b151dfcc2..4f58ef58a 100644
--- a/crypto/src/crypto/operators/Asn1CipherBuilder.cs
+++ b/crypto/src/crypto/operators/Asn1CipherBuilder.cs
@@ -23,7 +23,7 @@ namespace Org.BouncyCastle.Crypto.Operators
CipherKeyGenerator keyGen = CipherKeyGeneratorFactory.CreateKeyGenerator(encryptionOID, random);
encKey = new KeyParameter(keyGen.GenerateKey());
- algorithmIdentifier = AlgorithmIdentifierFactory.GenerateEncryptionAlgID(encryptionOID, encKey.GetKey().Length * 8, random);
+ algorithmIdentifier = AlgorithmIdentifierFactory.GenerateEncryptionAlgID(encryptionOID, encKey.KeyLength * 8, random);
}
public object AlgorithmDetails
diff --git a/crypto/test/src/test/BaseBlockCipherTest.cs b/crypto/test/src/test/BaseBlockCipherTest.cs
index aca912131..2997126f6 100644
--- a/crypto/test/src/test/BaseBlockCipherTest.cs
+++ b/crypto/test/src/test/BaseBlockCipherTest.cs
@@ -55,7 +55,7 @@ namespace Org.BouncyCastle.Tests
Fail("failed OID test");
}
- if (k.GetKey().Length != (16 + ((i / groupSize) * 8)))
+ if (k.KeyLength != (16 + ((i / groupSize) * 8)))
{
Fail("failed key length test");
}
@@ -87,7 +87,7 @@ namespace Org.BouncyCastle.Tests
Fail("failed wrap OID test");
}
- if (k.GetKey().Length != (16 + (i * 8)))
+ if (k.KeyLength != (16 + (i * 8)))
{
Fail("failed key length test");
}
diff --git a/crypto/test/src/test/HMacTest.cs b/crypto/test/src/test/HMacTest.cs
index e6fc07599..eccee245e 100644
--- a/crypto/test/src/test/HMacTest.cs
+++ b/crypto/test/src/test/HMacTest.cs
@@ -108,7 +108,7 @@ namespace Org.BouncyCastle.Tests
mac.BlockUpdate(message, 0, message.Length);
outBytes = MacUtilities.DoFinal(mac);
- IsTrue("default key wrong length", key.GetKey().Length == (defKeySize / 8));
+ IsTrue("default key wrong length", key.KeyLength == (defKeySize / 8));
}
private void DoTestExceptions()
|