diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-14 13:07:04 +0400 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-14 13:07:04 +0400 |
commit | 187f51f6da3abfe39c354e8d9d097f4286e2bf0b (patch) | |
tree | 2d0c2aab2e2104fb7093824fd3d18e0563df7153 /core/src/main/java/org/bouncycastle/crypto/tls/DefaultTlsCipherFactory.java | |
parent | bef9d8c34882273d391ccf6ff9331c7c4f81fcc1 (diff) |
Add GCM-based Camellia ciphersuites from RFC 6367
Diffstat (limited to 'core/src/main/java/org/bouncycastle/crypto/tls/DefaultTlsCipherFactory.java')
-rw-r--r-- | core/src/main/java/org/bouncycastle/crypto/tls/DefaultTlsCipherFactory.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/tls/DefaultTlsCipherFactory.java b/core/src/main/java/org/bouncycastle/crypto/tls/DefaultTlsCipherFactory.java index 262bac5e..d82af66f 100644 --- a/core/src/main/java/org/bouncycastle/crypto/tls/DefaultTlsCipherFactory.java +++ b/core/src/main/java/org/bouncycastle/crypto/tls/DefaultTlsCipherFactory.java @@ -58,8 +58,14 @@ public class DefaultTlsCipherFactory return createCipher_AES_GCM(context, 32, 16); case EncryptionAlgorithm.CAMELLIA_128_CBC: return createCamelliaCipher(context, 16, macAlgorithm); + case EncryptionAlgorithm.CAMELLIA_128_GCM: + // NOTE: Ignores macAlgorithm + return createCipher_Camellia_GCM(context, 16, 16); case EncryptionAlgorithm.CAMELLIA_256_CBC: return createCamelliaCipher(context, 32, macAlgorithm); + case EncryptionAlgorithm.CAMELLIA_256_GCM: + // NOTE: Ignores macAlgorithm + return createCipher_Camellia_GCM(context, 32, 16); case EncryptionAlgorithm.ESTREAM_SALSA20: return createSalsa20Cipher(context, 12, 32, macAlgorithm); case EncryptionAlgorithm.NULL: @@ -109,6 +115,13 @@ public class DefaultTlsCipherFactory createAEADBlockCipher_AES_GCM(), cipherKeySize, macSize); } + protected TlsAEADCipher createCipher_Camellia_GCM(TlsContext context, int cipherKeySize, int macSize) + throws IOException + { + return new TlsAEADCipher(context, createAEADBlockCipher_Camellia_GCM(), + createAEADBlockCipher_Camellia_GCM(), cipherKeySize, macSize); + } + protected TlsBlockCipher createDESedeCipher(TlsContext context, int macAlgorithm) throws IOException { @@ -149,6 +162,11 @@ public class DefaultTlsCipherFactory return new AESEngine(); } + protected BlockCipher createCamelliaEngine() + { + return new CamelliaEngine(); + } + protected BlockCipher createAESBlockCipher() { return new CBCBlockCipher(createAESEngine()); @@ -165,9 +183,15 @@ public class DefaultTlsCipherFactory return new GCMBlockCipher(createAESEngine()); } + protected AEADBlockCipher createAEADBlockCipher_Camellia_GCM() + { + // TODO Consider allowing custom configuration of multiplier + return new GCMBlockCipher(createCamelliaEngine()); + } + protected BlockCipher createCamelliaBlockCipher() { - return new CBCBlockCipher(new CamelliaEngine()); + return new CBCBlockCipher(createCamelliaEngine()); } protected BlockCipher createDESedeBlockCipher() |