You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by gi...@apache.org on 2013/06/16 16:13:45 UTC
svn commit: r1493514 - in /santuario/xml-security-java/trunk/src:
main/java/org/apache/xml/security/algorithms/
main/java/org/apache/xml/security/encryption/
main/java/org/apache/xml/security/resource/
main/java/org/apache/xml/security/stax/config/ mai...
Author: giger
Date: Sun Jun 16 14:13:44 2013
New Revision: 1493514
URL: http://svn.apache.org/r1493514
Log:
move key and iv length stuff to JCEMapper
Modified:
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/JCEMapper.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/resource/config.xml
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/JCEAlgorithmMapper.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractEncryptOutputProcessor.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/IVSplittingOutputStream.java
santuario/xml-security-java/trunk/src/main/resources/schemas/security-config.xsd
santuario/xml-security-java/trunk/src/main/resources/security-config.xml
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/IVSplittingOutputStreamTest.java
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/JCEMapper.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/JCEMapper.java?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/JCEMapper.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/JCEMapper.java Sun Jun 16 14:13:44 2013
@@ -123,55 +123,55 @@ public class JCEMapper {
);
algorithmsMap.put(
XMLSignature.ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5,
- new Algorithm("", "HmacMD5", "Mac")
+ new Algorithm("", "HmacMD5", "Mac", 128, 0)
);
algorithmsMap.put(
XMLSignature.ALGO_ID_MAC_HMAC_RIPEMD160,
- new Algorithm("", "HMACRIPEMD160", "Mac")
+ new Algorithm("", "HMACRIPEMD160", "Mac", 160, 0)
);
algorithmsMap.put(
XMLSignature.ALGO_ID_MAC_HMAC_SHA1,
- new Algorithm("", "HmacSHA1", "Mac")
+ new Algorithm("", "HmacSHA1", "Mac", 160, 0)
);
algorithmsMap.put(
XMLSignature.ALGO_ID_MAC_HMAC_SHA256,
- new Algorithm("", "HmacSHA256", "Mac")
+ new Algorithm("", "HmacSHA256", "Mac", 256, 0)
);
algorithmsMap.put(
XMLSignature.ALGO_ID_MAC_HMAC_SHA384,
- new Algorithm("", "HmacSHA384", "Mac")
+ new Algorithm("", "HmacSHA384", "Mac", 384, 0)
);
algorithmsMap.put(
XMLSignature.ALGO_ID_MAC_HMAC_SHA512,
- new Algorithm("", "HmacSHA512", "Mac")
+ new Algorithm("", "HmacSHA512", "Mac", 512, 0)
);
algorithmsMap.put(
XMLCipher.TRIPLEDES,
- new Algorithm("DESede", "DESede/CBC/ISO10126Padding", "BlockEncryption", 192)
+ new Algorithm("DESede", "DESede/CBC/ISO10126Padding", "BlockEncryption", 192, 64)
);
algorithmsMap.put(
XMLCipher.AES_128,
- new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 128)
+ new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 128, 128)
);
algorithmsMap.put(
XMLCipher.AES_192,
- new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 192)
+ new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 192, 128)
);
algorithmsMap.put(
XMLCipher.AES_256,
- new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 256)
+ new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 256, 128)
);
algorithmsMap.put(
XMLCipher.AES_128_GCM,
- new Algorithm("AES", "AES/GCM/NoPadding", "BlockEncryption", 128)
+ new Algorithm("AES", "AES/GCM/NoPadding", "BlockEncryption", 128, 96)
);
algorithmsMap.put(
XMLCipher.AES_192_GCM,
- new Algorithm("AES", "AES/GCM/NoPadding", "BlockEncryption", 192)
+ new Algorithm("AES", "AES/GCM/NoPadding", "BlockEncryption", 192, 96)
);
algorithmsMap.put(
XMLCipher.AES_256_GCM,
- new Algorithm("AES", "AES/GCM/NoPadding", "BlockEncryption", 256)
+ new Algorithm("AES", "AES/GCM/NoPadding", "BlockEncryption", 256, 96)
);
algorithmsMap.put(
XMLCipher.RSA_v1dot5,
@@ -191,19 +191,19 @@ public class JCEMapper {
);
algorithmsMap.put(
XMLCipher.TRIPLEDES_KeyWrap,
- new Algorithm("DESede", "DESedeWrap", "SymmetricKeyWrap", 192)
+ new Algorithm("DESede", "DESedeWrap", "SymmetricKeyWrap", 192, 0)
);
algorithmsMap.put(
XMLCipher.AES_128_KeyWrap,
- new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 128)
+ new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 128, 0)
);
algorithmsMap.put(
XMLCipher.AES_192_KeyWrap,
- new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 192)
+ new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 192, 0)
);
algorithmsMap.put(
XMLCipher.AES_256_KeyWrap,
- new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 256)
+ new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 256, 0)
);
}
@@ -258,6 +258,14 @@ public class JCEMapper {
}
return 0;
}
+
+ public static int getIVLengthFromURI(String algorithmURI) {
+ Algorithm algorithm = algorithmsMap.get(algorithmURI);
+ if (algorithm != null) {
+ return algorithm.ivLength;
+ }
+ return 0;
+ }
/**
* Method getJCEKeyAlgorithmFromURI
@@ -318,6 +326,7 @@ public class JCEMapper {
final String jceName;
final String algorithmClass;
final int keyLength;
+ final int ivLength;
final String jceProvider;
/**
@@ -334,32 +343,37 @@ public class JCEMapper {
} else {
keyLength = 0;
}
+ if (el.hasAttribute("IVLength")) {
+ ivLength = Integer.parseInt(el.getAttributeNS(null, "IVLength"));
+ } else {
+ ivLength = 0;
+ }
}
public Algorithm(String requiredKey, String jceName) {
- this(requiredKey, jceName, null, 0);
+ this(requiredKey, jceName, null, 0, 0);
}
public Algorithm(String requiredKey, String jceName, String algorithmClass) {
- this(requiredKey, jceName, algorithmClass, 0);
+ this(requiredKey, jceName, algorithmClass, 0, 0);
}
public Algorithm(String requiredKey, String jceName, int keyLength) {
- this(requiredKey, jceName, null, keyLength);
+ this(requiredKey, jceName, null, keyLength, 0);
}
- public Algorithm(String requiredKey, String jceName, String algorithmClass, int keyLength) {
- this(requiredKey, jceName, algorithmClass, keyLength, null);
+ public Algorithm(String requiredKey, String jceName, String algorithmClass, int keyLength, int ivLength) {
+ this(requiredKey, jceName, algorithmClass, keyLength, ivLength, null);
}
public Algorithm(String requiredKey, String jceName,
- String algorithmClass, int keyLength, String jceProvider) {
+ String algorithmClass, int keyLength, int ivLength, String jceProvider) {
this.requiredKey = requiredKey;
this.jceName = jceName;
this.algorithmClass = algorithmClass;
this.keyLength = keyLength;
+ this.ivLength = ivLength;
this.jceProvider = jceProvider;
}
}
-
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/encryption/XMLCipher.java Sun Jun 16 14:13:44 2013
@@ -1121,16 +1121,11 @@ public class XMLCipher {
// Now perform the encryption
try {
- // The Spec mandates a 96-bit IV for GCM algorithms
- if (AES_128_GCM.equals(algorithm) || AES_192_GCM.equals(algorithm)
- || AES_256_GCM.equals(algorithm)) {
- byte[] temp = new byte[12];
- XMLSecurityConstants.secureRandom.nextBytes(temp);
- IvParameterSpec paramSpec = new IvParameterSpec(temp);
- c.init(cipherMode, key, paramSpec);
- } else {
- c.init(cipherMode, key);
- }
+ int ivLen = JCEMapper.getIVLengthFromURI(algorithm) / 8;
+ byte[] temp = new byte[ivLen];
+ XMLSecurityConstants.secureRandom.nextBytes(temp);
+ IvParameterSpec paramSpec = new IvParameterSpec(temp);
+ c.init(cipherMode, key, paramSpec);
} catch (InvalidKeyException ike) {
throw new XMLEncryptionException("empty", ike);
}
@@ -1723,16 +1718,7 @@ public class XMLCipher {
throw new XMLEncryptionException("empty", nspae);
}
- // Calculate the IV length and copy out
-
- // For now, we only work with Block ciphers, so this will work.
- // This should probably be put into the JCE mapper.
-
- int ivLen = c.getBlockSize();
- String alg = encryptedData.getEncryptionMethod().getAlgorithm();
- if (AES_128_GCM.equals(alg) || AES_192_GCM.equals(alg) || AES_256_GCM.equals(alg)) {
- ivLen = 12;
- }
+ int ivLen = JCEMapper.getIVLengthFromURI(encryptedData.getEncryptionMethod().getAlgorithm()) / 8;
byte[] ivBytes = new byte[ivLen];
// You may be able to pass the entire piece in to IvParameterSpec
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/resource/config.xml
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/resource/config.xml?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
Binary files - no diff available.
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/JCEAlgorithmMapper.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/JCEAlgorithmMapper.java?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/JCEAlgorithmMapper.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/config/JCEAlgorithmMapper.java Sun Jun 16 14:13:44 2013
@@ -41,10 +41,14 @@ public class JCEAlgorithmMapper extends
if (algorithmType.getKeyLength() != null) {
keyLength = algorithmType.getKeyLength();
}
+ int ivLength = 0;
+ if (algorithmType.getIVLength() != null) {
+ ivLength = algorithmType.getIVLength();
+ }
Algorithm algorithm =
new Algorithm(algorithmType.getRequiredKey(), algorithmType.getJCEName(),
algorithmType.getAlgorithmClass(), keyLength,
- algorithmType.getJCEProvider());
+ ivLength, algorithmType.getJCEProvider());
register(algorithmType.getURI(), algorithm);
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java Sun Jun 16 14:13:44 2013
@@ -202,6 +202,7 @@ public abstract class AbstractDecryptInp
}
final String algorithmURI = encryptedDataType.getEncryptionMethod().getAlgorithm();
+ final int ivLength = JCEAlgorithmMapper.getIVLengthFromURI(algorithmURI) / 8;
Cipher symCipher = getCipher(algorithmURI);
//create a new Thread for streaming decryption
@@ -209,6 +210,7 @@ public abstract class AbstractDecryptInp
new DecryptionThread(subInputProcessorChain, isSecurityHeaderEvent);
decryptionThread.setSecretKey(inboundSecurityToken.getSecretKey(algorithmURI, XMLSecurityConstants.Enc, encryptedDataType.getId()));
decryptionThread.setSymmetricCipher(symCipher);
+ decryptionThread.setIvLength(ivLength);
XMLSecStartElement parentXMLSecStartElement = xmlSecStartElement.getParentXMLSecStartElement();
if (encryptedHeader) {
parentXMLSecStartElement = parentXMLSecStartElement.getParentXMLSecStartElement();
@@ -668,6 +670,7 @@ public abstract class AbstractDecryptInp
private final PipedOutputStream pipedOutputStream;
private final PipedInputStream pipedInputStream;
private Cipher symmetricCipher;
+ private int ivLength;
private Key secretKey;
protected DecryptionThread(InputProcessorChain inputProcessorChain,
@@ -704,7 +707,7 @@ public abstract class AbstractDecryptInp
try {
IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(
new CipherOutputStream(pipedOutputStream, getSymmetricCipher()),
- getSymmetricCipher(), getSecretKey());
+ getSymmetricCipher(), getSecretKey(), getIvLength());
//buffering seems not to help
//bufferedOutputStream = new BufferedOutputStream(new Base64OutputStream(ivSplittingOutputStream, false), 8192 * 5);
ReplaceableOuputStream replaceableOuputStream = new ReplaceableOuputStream(ivSplittingOutputStream);
@@ -759,6 +762,14 @@ public abstract class AbstractDecryptInp
this.symmetricCipher = symmetricCipher;
}
+ int getIvLength() {
+ return ivLength;
+ }
+
+ void setIvLength(int ivLength) {
+ this.ivLength = ivLength;
+ }
+
protected Key getSecretKey() {
return secretKey;
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractEncryptOutputProcessor.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractEncryptOutputProcessor.java?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractEncryptOutputProcessor.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractEncryptOutputProcessor.java Sun Jun 16 14:13:44 2013
@@ -19,6 +19,7 @@
package org.apache.xml.security.stax.impl.processor.output;
import org.apache.commons.codec.binary.Base64OutputStream;
+import org.apache.xml.security.algorithms.JCEMapper;
import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.stax.config.JCEAlgorithmMapper;
import org.apache.xml.security.stax.ext.AbstractOutputProcessor;
@@ -151,17 +152,11 @@ public abstract class AbstractEncryptOut
}
Cipher symmetricCipher = Cipher.getInstance(jceAlgorithm);
- // The Spec mandates a 96-bit IV for GCM algorithms
- if ("AES/GCM/NoPadding".equals(symmetricCipher.getAlgorithm())) {
- byte[] temp = new byte[12];
- XMLSecurityConstants.secureRandom.nextBytes(temp);
- IvParameterSpec ivParameterSpec = new IvParameterSpec(temp);
- symmetricCipher.init(Cipher.ENCRYPT_MODE, encryptionPartDef.getSymmetricKey(), ivParameterSpec);
- } else {
- symmetricCipher.init(Cipher.ENCRYPT_MODE, encryptionPartDef.getSymmetricKey());
- }
- //Should internally generate an IV
- byte[] iv = symmetricCipher.getIV();
+ int ivLen = JCEMapper.getIVLengthFromURI(encryptionSymAlgorithm) / 8;
+ byte[] iv = new byte[ivLen];
+ XMLSecurityConstants.secureRandom.nextBytes(iv);
+ IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
+ symmetricCipher.init(Cipher.ENCRYPT_MODE, encryptionPartDef.getSymmetricKey(), ivParameterSpec);
characterEventGeneratorOutputStream = new CharacterEventGeneratorOutputStream();
Base64OutputStream base64EncoderStream =
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/IVSplittingOutputStream.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/IVSplittingOutputStream.java?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/IVSplittingOutputStream.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/IVSplittingOutputStream.java Sun Jun 16 14:13:44 2013
@@ -46,13 +46,9 @@ public class IVSplittingOutputStream ext
private final Cipher cipher;
private final Key secretKey;
- public IVSplittingOutputStream(OutputStream out, Cipher cipher, Key secretKey) {
+ public IVSplittingOutputStream(OutputStream out, Cipher cipher, Key secretKey, int ivLength) {
super(out);
- if ("AES/GCM/NoPadding".equals(cipher.getAlgorithm())) {
- ivLength = 12;
- } else {
- ivLength = cipher.getBlockSize();
- }
+ this.ivLength = ivLength;
iv = new byte[ivLength];
this.cipher = cipher;
this.secretKey = secretKey;
Modified: santuario/xml-security-java/trunk/src/main/resources/schemas/security-config.xsd
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/resources/schemas/security-config.xsd?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/resources/schemas/security-config.xsd (original)
+++ santuario/xml-security-java/trunk/src/main/resources/schemas/security-config.xsd Sun Jun 16 14:13:44 2013
@@ -16,6 +16,7 @@
<xs:attribute type="xs:string" name="JCEProvider" use="optional"/>
<xs:attribute type="xs:string" name="JCEName" use="required"/>
<xs:attribute type="xs:int" name="KeyLength" use="optional"/>
+ <xs:attribute type="xs:int" name="IVLength" use="optional"/>
<xs:attribute type="xs:string" name="RequiredKey" use="optional"/>
</xs:extension>
</xs:simpleContent>
Modified: santuario/xml-security-java/trunk/src/main/resources/security-config.xml
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/resources/security-config.xml?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/resources/security-config.xml (original)
+++ santuario/xml-security-java/trunk/src/main/resources/security-config.xml Sun Jun 16 14:13:44 2013
@@ -282,6 +282,7 @@
AlgorithmClass="BlockEncryption"
RequirementLevel="REQUIRED"
KeyLength="192"
+ IVLength="64"
RequiredKey="DESede"
JCEName="DESede/CBC/ISO10126Padding"/>
@@ -290,6 +291,7 @@
AlgorithmClass="BlockEncryption"
RequirementLevel="REQUIRED"
KeyLength="128"
+ IVLength="128"
RequiredKey="AES"
JCEName="AES/CBC/ISO10126Padding"/>
@@ -298,6 +300,7 @@
AlgorithmClass="BlockEncryption"
RequirementLevel="OPTIONAL"
KeyLength="192"
+ IVLength="128"
RequiredKey="AES"
JCEName="AES/CBC/ISO10126Padding"/>
@@ -306,6 +309,7 @@
AlgorithmClass="BlockEncryption"
RequirementLevel="REQUIRED"
KeyLength="256"
+ IVLength="128"
RequiredKey="AES"
JCEName="AES/CBC/ISO10126Padding"/>
@@ -314,6 +318,7 @@
AlgorithmClass="BlockEncryption"
RequirementLevel="OPTIONAL"
KeyLength="128"
+ IVLength="96"
RequiredKey="AES"
JCEName="AES/GCM/NoPadding"/>
@@ -322,6 +327,7 @@
AlgorithmClass="BlockEncryption"
RequirementLevel="OPTIONAL"
KeyLength="192"
+ IVLength="96"
RequiredKey="AES"
JCEName="AES/GCM/NoPadding"/>
@@ -330,6 +336,7 @@
AlgorithmClass="BlockEncryption"
RequirementLevel="OPTIONAL"
KeyLength="256"
+ IVLength="96"
RequiredKey="AES"
JCEName="AES/GCM/NoPadding"/>
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/IVSplittingOutputStreamTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/IVSplittingOutputStreamTest.java?rev=1493514&r1=1493513&r2=1493514&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/IVSplittingOutputStreamTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/IVSplittingOutputStreamTest.java Sun Jun 16 14:13:44 2013
@@ -48,7 +48,7 @@ public class IVSplittingOutputStreamTest
Cipher cipher = Cipher.getInstance("AES/CBC/ISO10126Padding");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey);
+ IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey, ivSize);
ReplaceableOuputStream replaceableOuputStream = new ReplaceableOuputStream(ivSplittingOutputStream);
ivSplittingOutputStream.setParentOutputStream(replaceableOuputStream);
byte[] testBytes = testString.getBytes();
@@ -74,7 +74,7 @@ public class IVSplittingOutputStreamTest
Cipher cipher = Cipher.getInstance("AES/CBC/ISO10126Padding");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey);
+ IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey, ivSize);
ReplaceableOuputStream replaceableOuputStream = new ReplaceableOuputStream(ivSplittingOutputStream);
ivSplittingOutputStream.setParentOutputStream(replaceableOuputStream);
replaceableOuputStream.write(testString.getBytes());
@@ -97,7 +97,7 @@ public class IVSplittingOutputStreamTest
Cipher cipher = Cipher.getInstance("AES/CBC/ISO10126Padding");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey);
+ IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey, ivSize);
ReplaceableOuputStream replaceableOuputStream = new ReplaceableOuputStream(ivSplittingOutputStream);
ivSplittingOutputStream.setParentOutputStream(replaceableOuputStream);
@@ -126,7 +126,7 @@ public class IVSplittingOutputStreamTest
Cipher cipher = Cipher.getInstance("AES/CBC/ISO10126Padding");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey);
+ IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey, ivSize);
ReplaceableOuputStream replaceableOuputStream = new ReplaceableOuputStream(ivSplittingOutputStream);
ivSplittingOutputStream.setParentOutputStream(replaceableOuputStream);
@@ -153,7 +153,7 @@ public class IVSplittingOutputStreamTest
Cipher cipher = Cipher.getInstance("AES/CBC/ISO10126Padding");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey);
+ IVSplittingOutputStream ivSplittingOutputStream = new IVSplittingOutputStream(byteArrayOutputStream, cipher, secretKey, ivSize);
ReplaceableOuputStream replaceableOuputStream = new ReplaceableOuputStream(ivSplittingOutputStream);
ivSplittingOutputStream.setParentOutputStream(replaceableOuputStream);