byte[] buf = engineDoFinal(input, inputOffset, inputLength); System.arraycopy(buf, 0, output, outputOffset, buf.length); return buf.length;
public void engineInit( int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch (InvalidAlgorithmParameterException e) { throw new IllegalArgumentException("cannot handle supplied parameter spec: " + e.getMessage()); } }
try { BlockCipher cbcCipher = new CBCBlockCipher(new AESEngine()); IESCipher cipher = new IESCipher( new IESEngine(new ECDHBasicAgreement(), new KDF2BytesGenerator(new SHA1Digest()), cipher.engineInit(Cipher.ENCRYPT_MODE, publicKey, spec, new SecureRandom()); byte[] bcResult = cipher.engineDoFinal(keyToWrap, 0, keyToWrap.length);
IESCipher keyCipher = new IESCipher( new IESEngine(new ECDHBasicAgreement(), new KDF2BytesGenerator(DigestFactory.createSHA1()), new PaddedBufferedBlockCipher(cbcCipher)), 16); keyCipher.engineInit(Cipher.DECRYPT_MODE, requestorKey, spec, null); System.arraycopy(macTag, 0, bcInput, offset, macTag.length); symmKey = keyCipher.engineDoFinal(bcInput, 0, bcInput.length); } else { throw new Exception("unsupported decryption key type " + requestorKey.getClass().getName());
IESCipher keyCipher = new IESCipher( new IESEngine(new ECDHBasicAgreement(), new KDF2BytesGenerator(DigestFactory.createSHA1()), new PaddedBufferedBlockCipher(cbcCipher)), 16); keyCipher.engineInit(Cipher.DECRYPT_MODE, decKey, spec, null); System.arraycopy(macTag, 0, bcInput, offset, macTag.length); symmKey = keyCipher.engineDoFinal(bcInput, 0, bcInput.length); } else { throw new XiSecurityException("unsupported decryption key type "
public void engineInit( int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { AlgorithmParameterSpec paramSpec = null; if (params != null) { try { paramSpec = params.getParameterSpec(IESParameterSpec.class); } catch (Exception e) { throw new InvalidAlgorithmParameterException("cannot recognise parameters: " + e.toString()); } } engineParam = params; engineInit(opmode, key, paramSpec, random); }