Package org.jitterbit.crypto.pgp

Examples of org.jitterbit.crypto.pgp.FileDecryptor


        enc.signAndEncrypt(clearTextMessage, signedAndEncryptedMessage, encryptionKey, signatureKey,
                        "sender".toCharArray());
    }

    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


    }
   
    public void runDecryption() throws Exception {
        File output = new File(root, "decrypted_with_jitterbit.txt");
        File keyFile = new File(root, "receiver/secring.gpg");
        FileDecryptor dec = getFileDecryptor();
        dec.decrypt(encrypted, output, new FileBasedKey(keyFile), "receiver".toCharArray());
    }
View Full Code Here

        dec.decrypt(encrypted, output, new FileBasedKey(keyFile), "receiver".toCharArray());
    }
   
    private FileDecryptor getFileDecryptor() {
        PgpProvider provider = BouncyCastlePgpProvider.getInstance();
        return new FileDecryptor(provider.getDecryptor());
    }
View Full Code Here

TOP

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

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.