Search in sources :

Example 1 with TextEncryptor

use of org.craftercms.commons.crypto.TextEncryptor in project commons by craftercms.

the class EncryptionTool method encrypt.

private static void encrypt(CommandLine line) throws MissingOptionException, CryptoException {
    String clearText = line.getOptionValue(ENC_OPTION);
    TextEncryptor encryptor = createEncryptor(line);
    String cipherText = encryptor.encrypt(clearText);
    System.out.print("Cipher text (in Base 64): ");
    System.out.println(cipherText);
}
Also used : TextEncryptor(org.craftercms.commons.crypto.TextEncryptor)

Example 2 with TextEncryptor

use of org.craftercms.commons.crypto.TextEncryptor in project commons by craftercms.

the class EncryptionTool method decrypt.

private static void decrypt(CommandLine line) throws MissingOptionException, CryptoException {
    String cipherText = line.getOptionValue(DEC_OPTION);
    TextEncryptor encryptor = createEncryptor(line);
    String clearText = encryptor.decrypt(cipherText);
    System.out.print("Clear text: ");
    System.out.println(clearText);
}
Also used : TextEncryptor(org.craftercms.commons.crypto.TextEncryptor)

Aggregations

TextEncryptor (org.craftercms.commons.crypto.TextEncryptor)2