Examples of encrypt()


Examples of org.jasypt.encryption.pbe.StandardPBEStringEncryptor.encrypt()

        StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
        EnvironmentStringPBEConfig env = new EnvironmentStringPBEConfig();
        env.setAlgorithm("PBEWithMD5AndDES");
        env.setPassword("password");
        enc.setConfig(env);
        String val = enc.encrypt("bar");
        System.setProperty("foo", val);

        System.setProperty("org.bundles.framework.storage", "target/bundles/" + System.currentTimeMillis());
        System.setProperty("karaf.name", "root");
View Full Code Here

Examples of org.jasypt.intf.service.JasyptStatelessService.encrypt()

            String input = argumentValues.getProperty(ArgumentNaming.ARG_INPUT);

            CLIUtils.showArgumentDescription(argumentValues, verbose);
           
            String result =
                service.encrypt(
                        input,
                        argumentValues.getProperty(ArgumentNaming.ARG_PASSWORD),
                        null,
                        null,
                        argumentValues.getProperty(ArgumentNaming.ARG_ALGORITHM),
View Full Code Here

Examples of org.jasypt.util.binary.BasicBinaryEncryptor.encrypt()

      // Declare a basic encryptor
      BasicBinaryEncryptor be = new BasicBinaryEncryptor();
      // Set password to use
      be.setPassword(PASSWORD_FOR_ENCRYPTION);
      // Encrypt data. By default the algorithm used is PBEWithMD5AndDES
      byte[] encryptedData = be.encrypt(data);
      // Valid "encrypted" data
      byte[] decryptedData = be.decrypt(encryptedData);
      Assert.assertArrayEquals(data, decryptedData);
      // Create a image file with the decrypted data in order to validate
      // that data are not corrupted
View Full Code Here

Examples of org.jasypt.util.binary.StrongBinaryEncryptor.encrypt()

      StrongBinaryEncryptor be = new StrongBinaryEncryptor();
      // Set password to use
      be.setPassword(PASSWORD_FOR_ENCRYPTION);
      // Encrypt data. By default the algorithm used is
      // PBEWithMD5AndTripleDES
      byte[] encryptedData = be.encrypt(data);
      // Valid "encrypted" data
      byte[] decryptedData = be.decrypt(encryptedData);
      Assert.assertArrayEquals(data, decryptedData);
      // Create a image file with the decrypted data in order to validate
      // that data are not corrupted
View Full Code Here

Examples of org.jasypt.util.text.BasicTextEncryptor.encrypt()

    // Declare a basic encryptor
    BasicTextEncryptor te = new BasicTextEncryptor();
    // Set password to use
    te.setPassword(PASSWORD_FOR_ENCRYPTION);
    // Encrypt text. By default the algorithm used is PBEWithMD5AndDES
    String encryptedText = te.encrypt(TEXT_TO_ENCRYPT);
    System.out.printf("testTextEncryptionUsingBasicTextEncryptor : '%s' become '%s'\n", TEXT_TO_ENCRYPT, encryptedText);
    // Valid "encrypted" text
    Assert.assertEquals(te.decrypt(encryptedText), TEXT_TO_ENCRYPT);
  }
View Full Code Here

Examples of org.jasypt.util.text.StrongTextEncryptor.encrypt()

    // Declare a strong encryptor
    StrongTextEncryptor te = new StrongTextEncryptor();
    // Set password to use
    te.setPassword(PASSWORD_FOR_ENCRYPTION);
    // Encrypt text. By default the algorithm used is PBEWithMD5AndTripleDES
    String encryptedText = te.encrypt(TEXT_TO_ENCRYPT);
    System.out.printf("testTextEncryptionUsingStrongTextEncryptor : '%s' become '%s'\n", TEXT_TO_ENCRYPT, encryptedText);
    // Valid "encrypted" text
    Assert.assertEquals(te.decrypt(encryptedText), TEXT_TO_ENCRYPT);
  }
View Full Code Here

Examples of org.jboss.aerogear.crypto.password.Pbkdf2.encrypt()

    @Test
    public void testAcceptPasswordBasedPrivateKey() throws Exception {
        try {
            Pbkdf2 pbkdf2 = AeroGearCrypto.pbkdf2();
            byte[] rawPassword = pbkdf2.encrypt(PASSWORD);
            new CryptoBox(new PrivateKey(rawPassword));
        } catch (Exception e) {
            fail("CryptoBox should accept key pairs");
        }
    }
View Full Code Here

Examples of org.jitterbit.crypto.pgp.FileEncryptor.encrypt()

    }
   
    private File encryptFile(File clear) throws Exception {
        FileEncryptor enc = getFileEncryptor();
        Key key = new FileBasedKey(new File(root, "receiver/pubring.gpg"), "Receiver <receiver@jitterbit.com>");
        enc.encrypt(clear, encrypted, key);
        return encrypted;
    }
   
    private FileEncryptor getFileEncryptor() {
        PgpProvider provider = BouncyCastlePgpProvider.getInstance();
View Full Code Here

Examples of org.jitterbit.crypto.pgp.PassphraseCrypto.encrypt()

   
    @Test
    public void run() {
        try {
            PassphraseCrypto crypto = BouncyCastlePgpProvider.getInstance().getPassphraseCrypto();
            byte[] encrypted = crypto.encrypt(MESSAGE.getBytes(), PASSPHRASE, SymmetricKeyAlgorithm.CAST5);
            byte[] decrypted = crypto.decrypt(encrypted, PASSPHRASE);
            assertEquals(MESSAGE, new String(decrypted));
        }
        catch (IOException ex) {
            ex.printStackTrace();
View Full Code Here

Examples of org.jitterbit.util.crypto.DefaultPBEStringCryptographer.encrypt()

    public static String encryptString(String plainText, String passPhrase) throws ServerCryptoException {
        try {
            PBEStringCryptographer crypto = new DefaultPBEStringCryptographer(salt, 1);
            crypto.setAlgorithm(algorithm);
            crypto.setPassphrase(passPhrase);
            byte[] encrypted = crypto.encrypt(plainText);
            Base64 base64 = new Base64();
            return new String(base64.encode(encrypted));
        } catch (StringCryptographerException ex) {
            throw new ServerCryptoException(ex);
        } catch (StringEncryptionException ex) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.