throw new NoSuchAlgorithmException(e.toString()); } catch (IllegalBlockSizeException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (IllegalBlockSizeException e) {
protected void engineInit( int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch (InvalidAlgorithmParameterException e) { // this shouldn't happen throw new InvalidKeyException("Eeeek! " + e.toString(), e); } }
protected void engineInit( int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch (InvalidAlgorithmParameterException e) { // this shouldn't happen throw new InvalidKeyException("Eeeek! " + e.toString(), e); } }
protected void engineInit( int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch (InvalidAlgorithmParameterException e) { // this shouldn't happen throw new InvalidKeyException("Eeeek! " + e.toString(), e); } }
protected void engineInit( int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch (InvalidAlgorithmParameterException e) { // this shouldn't happen throw new InvalidKeyException("Eeeek! " + e.toString(), e); } }
protected void engineInit( int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch (InvalidAlgorithmParameterException e) { // this shouldn't happen throw new InvalidKeyException("Eeeek! " + e.toString(), e); } }
protected void engineInit( int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch (InvalidAlgorithmParameterException e) { // this shouldn't happen throw new InvalidKeyException("Eeeek! " + e.toString(), e); } }
throw new NoSuchAlgorithmException(e.toString()); } catch (IllegalBlockSizeException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (IllegalBlockSizeException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (IllegalBlockSizeException e) {
protected void engineInit( int opmode, Key key, SecureRandom random) throws InvalidKeyException { try { engineInit(opmode, key, (AlgorithmParameterSpec)null, random); } catch (InvalidAlgorithmParameterException e) { // this shouldn't happen throw new InvalidKeyException("Eeeek! " + e.toString(), e); } }
throw new NoSuchAlgorithmException(e.toString()); } catch (IllegalBlockSizeException e) {
throw new NoSuchAlgorithmException(e.toString()); } catch (IllegalBlockSizeException e) {
protected void setIV(byte[] iv, boolean isEncrypt) { if (_ivLength == 0) { return; } if (isEncrypt) { _encryptIV = new byte[_ivLength]; System.arraycopy(iv, 0, _encryptIV, 0, _ivLength); try { encCipher = getCipher(isEncrypt); ParametersWithIV parameterIV = new ParametersWithIV( new KeyParameter(_key.getEncoded()), _encryptIV); encCipher.init(isEncrypt, parameterIV); } catch (InvalidAlgorithmParameterException e) { logger.info(e.toString()); } } else { _decryptIV = new byte[_ivLength]; System.arraycopy(iv, 0, _decryptIV, 0, _ivLength); try { decCipher = getCipher(isEncrypt); ParametersWithIV parameterIV = new ParametersWithIV( new KeyParameter(_key.getEncoded()), _decryptIV); decCipher.init(isEncrypt, parameterIV); } catch (InvalidAlgorithmParameterException e) { logger.info(e.toString()); } } }
protected void setIV(byte[] iv, boolean isEncrypt) { if (_ivLength == 0) { return; } if (isEncrypt) { _encryptIV = new byte[_ivLength]; System.arraycopy(iv, 0, _encryptIV, 0, _ivLength); try { encCipher = getCipher(isEncrypt); ParametersWithIV parameterIV = new ParametersWithIV( new KeyParameter(_key.getEncoded()), _encryptIV); encCipher.init(isEncrypt, parameterIV); } catch (InvalidAlgorithmParameterException e) { logger.info(e.toString()); } } else { _decryptIV = new byte[_ivLength]; System.arraycopy(iv, 0, _decryptIV, 0, _ivLength); try { decCipher = getCipher(isEncrypt); ParametersWithIV parameterIV = new ParametersWithIV( new KeyParameter(_key.getEncoded()), _decryptIV); decCipher.init(isEncrypt, parameterIV); } catch (InvalidAlgorithmParameterException e) { logger.info(e.toString()); } } }
private Cipher getInitialisedCipher(Key key, byte[] iv, int mode, String provider) throws JoseException { Cipher cipher = CipherUtil.getCipher(algorithm, provider); try { GCMParameterSpec parameterSpec = new GCMParameterSpec(ByteUtil.bitLength(tagByteLength), iv); cipher.init(mode, key, parameterSpec); return cipher; } catch (java.security.InvalidKeyException e) { throw new JoseException("Invalid key for " + algorithm, e); } catch (InvalidAlgorithmParameterException e) { throw new JoseException(e.toString(), e); } }
protected void setIV(byte[] iv, boolean isEncrypt) { if (_ivLength == 0) { return; } CipherParameters cipherParameters = null; if (isEncrypt) { cipherParameters = getCipherParameters(iv); try { encCipher = getCipher(isEncrypt); } catch (InvalidAlgorithmParameterException e) { logger.info(e.toString()); } encCipher.init(isEncrypt, cipherParameters); } else { _decryptIV = Arrays.copyOfRange(iv,0,_ivLength); cipherParameters = getCipherParameters(iv); try { decCipher = getCipher(isEncrypt); } catch (InvalidAlgorithmParameterException e) { logger.info(e.toString()); } decCipher.init(isEncrypt, cipherParameters); } }
throw new JoseException(e.toString(), e);
throw new JoseException(e.toString(), e);