Code example for IvParameterSpec

Methods: getIV

0
 
	private static byte[] packKeyAndIv(SecretKeySpec encryptedKeySpec, IvParameterSpec ivSpec)
			throws IOException { 
		ByteArrayOutputStream bOut = new ByteArrayOutputStream();
 
		bOut.write(ivSpec.getIV());
		bOut.write(((java.security.Key) encryptedKeySpec).getEncoded());
 
		return bOut.toByteArray();
 
	} 
 
	private static Object[] unpackKeyAndIV(byte[] data) {
 
		byte[] keyD = new byte[16];
		byte[] iv = new byte[data.length - 16];
 
		return new Object[] {
				new SecretKeySpec(data, 16, data.length - 16, "AES"),
				new IvParameterSpec(data, 0, 16) };
Connect your IDE to all the code out there  Get Codota for Java