public static String wrap(String clearText,String key){
  byte[] iv=getIv();
  byte[] cipherText=encrypt(clearText,key,iv);
  byte[] wrapped=new byte[iv.length + cipherText.length];
  System.arraycopy(iv,0,wrapped,0,iv.length);
  System.arraycopy(cipherText,0,wrapped,16,cipherText.length);
  return new String(Base64.encodeBase64(wrapped));
}

public static String wrap ( String clearText , String key ) { byte [ ] iv = getIv ( ) ; byte [ ] cipherText = encrypt ( clearText , key , iv ) ; byte [ ] wrapped = new byte [ iv . length + cipherText . length ] ; System . arraycopy ( iv , 0 , wrapped , 0 , iv . length ) ; System . arraycopy ( cipherText , 0 , wrapped , 16 , cipherText . length ) ; return new String ( Base64 . encodeBase64 ( wrapped ) ) ; }
encrypt a string with a given key .
