public static String encipher(String key, String clearText) {
        if (key == null) {
            throw new NullPointerException("key may not be null");
        }

        if (key == "") {
            return clearText;
        }

        if (clearText == null) {
            return null;
        }

        byte[] keyBytes = convertKeyToByteArray(key);
        byte[] clearTextBytes = convertClearTextToByteArray(clearText);
        byte[] cipherBytes = applyCipher(keyBytes, clearTextBytes);
        return Base64.encodeToString(cipherBytes);
    }
public static String encipher ( String key , String clearText ) { if ( key == null ) { throw new NullPointerException ( "key may not be null" ) ; } if ( key == "" ) { return clearText ; } if ( clearText == null ) { return null ; } byte [ ] keyBytes = convertKeyToByteArray ( key ) ; byte [ ] clearTextBytes = convertClearTextToByteArray ( clearText ) ; byte [ ] cipherBytes = applyCipher ( keyBytes , clearTextBytes ) ; return Base64 . encodeToString ( cipherBytes ) ; }
Use the key to produce a ciphered String from the clearText.