public static Cipher getCipher ( final @ NotNull Key key , int mode ) { try { Cipher cipher = Cipher . getInstance ( key . getAlgorithm ( ) ) ; cipher . init ( mode , key ) ; return cipher ; } catch ( NoSuchAlgorithmException | InvalidKeyException | NoSuchPaddingException e ) { throw new RuntimeException ( e ) ; } }
Creates a new Cipher