Package org.jitterbit.crypto.pgp

Examples of org.jitterbit.crypto.pgp.Key


    }

    private static void signAndEncrypt() throws Exception {
        FileEncryptor enc = new FileEncryptor(BouncyCastlePgpProvider.getInstance().getEncryptor());
        enc.setArmor(true);
        Key encryptionKey = new FileBasedKey(new File(root, "receiver\\pubring.gpg"),
                        "Receiver <receiver@jitterbit.com>");
        Key signatureKey = new FileBasedKey(new File(root, "sender\\secring.gpg"));
        enc.signAndEncrypt(clearTextMessage, signedAndEncryptedMessage, encryptionKey, signatureKey,
                        "sender".toCharArray());
    }
View Full Code Here


    }

    private static void decrypt() throws Exception {
        FileDecryptor dec = new FileDecryptor(BouncyCastlePgpProvider.getInstance().getDecryptor());
        File output = new File(root, "output");
        Key decryptionKey = new FileBasedKey(new File(root, "receiver\\secring.gpg"));
        Key verificationKey = new FileBasedKey(new File(root, "sender\\pubring.gpg"));
        dec.setVerificationKey(verificationKey);
        FileDecryptionResult res = dec.decrypt(signedAndEncryptedMessage, output, decryptionKey, "receiver".toCharArray());
        System.out.println(res.authenticationStatus());
        if (res.authenticationStatus() != MessageAuthenticationStatus.AUTHENTICATION_VERIFIED) {
            System.err.println("Fake sender! Danger, Will Robinson!");
View Full Code Here

        return file;
    }
   
    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;
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.crypto.pgp.Key

Copyright © 2018 www.massapicom. 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.