/** * Creates a SymmetricCryptor using the supplied byte array as the key * * @param key * @return a new SymmetricCryptor * @throws CryptoException */ public static SymmetricCryptor getSymmectricCryptor(byte[] key, boolean cbc) throws CryptoException { Key secretKey = new SecretKeySpec(key, DEFAULT_SYM_KEY_ALGORITHM); return new SymmetricCryptor(secretKey, cbc); }
public static SymmetricCryptor getSymmectricCryptor(byte[] key, String algorithm, String cipherAlgorithm, IvParameterSpec iv) throws CryptoException { Key secretKey = new SecretKeySpec(key, algorithm); return new SymmetricCryptor(secretKey, cipherAlgorithm, iv); }
/** * Creates a SymmetricCryptor using the supplied byte array as the key * * @param key * @return a new SymmetricCryptor * @throws CryptoException */ public static SymmetricCryptor getSymmectricCryptor(byte[] key, boolean cbc) throws CryptoException { Key secretKey = new SecretKeySpec(key, DEFAULT_SYM_KEY_ALGORITHM); return new SymmetricCryptor(secretKey, cbc); }
public static SymmetricCryptor getSymmectricCryptor(byte[] key, String algorithm, String cipherAlgorithm, IvParameterSpec iv) throws CryptoException { Key secretKey = new SecretKeySpec(key, algorithm); return new SymmetricCryptor(secretKey, cipherAlgorithm, iv); }
/** * Creates a new SymmetricCryptor with a new symmetric key * * @return a new SymmetricCryptor * @throws CryptoException */ public static SymmetricCryptor getSymmectricCryptor(boolean cbc) throws CryptoException { Key key = generateKey(); return new SymmetricCryptor(key, cbc); }
/** * Creates a new SymmetricCryptor with a new symmetric key * * @return a new SymmetricCryptor * @throws CryptoException */ public static SymmetricCryptor getSymmectricCryptor(boolean cbc) throws CryptoException { Key key = generateKey(); return new SymmetricCryptor(key, cbc); }
/** * Creates a SymmetricCryptor using the supplied URL contents as the key * * @param key * @return a new SymmetricCryptor * @throws CryptoException * @throws IOException */ public static SymmetricCryptor getSymmectricCryptor(URL keyResource) throws CryptoException, IOException { ArgCheck.isNotNull(keyResource); InputStream stream = keyResource.openStream(); try { KeyStore store = KeyStore.getInstance("JCEKS"); //$NON-NLS-1$ store.load(stream, DEFAULT_STORE_PASSWORD.toCharArray()); Key key = store.getKey(DEFAULT_ALIAS, DEFAULT_STORE_PASSWORD.toCharArray()); return new SymmetricCryptor(key, true); } catch (GeneralSecurityException e) { throw new CryptoException(CorePlugin.Event.TEIID10022, e); } finally { stream.close(); } }
/** * Creates a SymmetricCryptor using the supplied URL contents as the key * * @param key * @return a new SymmetricCryptor * @throws CryptoException * @throws IOException */ public static SymmetricCryptor getSymmectricCryptor(URL keyResource) throws CryptoException, IOException { ArgCheck.isNotNull(keyResource); InputStream stream = keyResource.openStream(); try { KeyStore store = KeyStore.getInstance("JCEKS"); //$NON-NLS-1$ store.load(stream, DEFAULT_STORE_PASSWORD.toCharArray()); Key key = store.getKey(DEFAULT_ALIAS, DEFAULT_STORE_PASSWORD.toCharArray()); return new SymmetricCryptor(key, true); } catch (GeneralSecurityException e) { throw new CryptoException(CorePlugin.Event.TEIID10022, e); } finally { stream.close(); } }