public BasicCryptor( Key encryptKey, Key decryptKey, String algorithm, IvParameterSpec iv) throws CryptoException { this.encryptKey = encryptKey; this.cipherAlgorithm = algorithm; this.decryptKey = decryptKey; this.iv = iv; if (iv != null) { randBuffer = new byte[iv.getIV().length]; } initEncryptCipher(); initDecryptCipher(); }
public BasicCryptor( Key encryptKey, Key decryptKey, String algorithm, IvParameterSpec iv) throws CryptoException { this.encryptKey = encryptKey; this.cipherAlgorithm = algorithm; this.decryptKey = decryptKey; this.iv = iv; if (iv != null) { randBuffer = new byte[iv.getIV().length]; } initEncryptCipher(); initDecryptCipher(); }
/** * Decrypt the ciphertext to yield the original cleartext. * @param ciphertext The text to be encrypted, in byte form * @param The decrypted cleartext, in byte form */ public synchronized byte[] decrypt( byte[] ciphertext ) throws CryptoException { try { byte[] result = decryptCipher.doFinal(ciphertext); if (iv != null) { //throw away the first block return Arrays.copyOfRange(result, iv.getIV().length, result.length); } return result; } catch ( Exception e ) { try { initDecryptCipher(); } catch (CryptoException err) { //shouldn't happen } throw new CryptoException(CorePlugin.Event.TEIID10006, CorePlugin.Util.gs(CorePlugin.Event.TEIID10006, e.getClass().getName(), e.getMessage())); } }
/** * Decrypt the ciphertext to yield the original cleartext. * @param ciphertext The text to be encrypted, in byte form * @param The decrypted cleartext, in byte form */ public synchronized byte[] decrypt( byte[] ciphertext ) throws CryptoException { try { byte[] result = decryptCipher.doFinal(ciphertext); if (iv != null) { //throw away the first block return Arrays.copyOfRange(result, iv.getIV().length, result.length); } return result; } catch ( Exception e ) { try { initDecryptCipher(); } catch (CryptoException err) { //shouldn't happen } throw new CryptoException(CorePlugin.Event.TEIID10006, CorePlugin.Util.gs(CorePlugin.Event.TEIID10006, e.getClass().getName(), e.getMessage())); } }
} catch ( Exception e ) { try { initDecryptCipher(); } catch (CryptoException err) {
} catch ( Exception e ) { try { initDecryptCipher(); } catch (CryptoException err) {