Examples of authenticationStatus()


Examples of org.jitterbit.crypto.pgp.DecryptionResult.authenticationStatus()

        try {
            encryptingKey = new StreamBasedKey(RECEIVER_PUBLIC_KEY, RECEIVER_ID);
            decryptingKey = new StreamBasedKey(RECEIVER_PRIVATE_KEY);
            byte[] encrypted = encryptor.encrypt(CLEAR_TEXT.getBytes("UTF-8"), encryptingKey, false);
            DecryptionResult result = decryptor.decrypt(encrypted, decryptingKey, RECEIVER_PASSWORD);
            assertSame(MessageAuthenticationStatus.NOT_SIGNED, result.authenticationStatus());
            assertSame(MessageIntegrity.INTEGRITY_VERIFIED, result.messageIntegrity());
            assertEquals(CLEAR_TEXT, new String(result.message(), "UTF-8"));
        } catch (Exception ex) {
            fail();
        } finally {
View Full Code Here

Examples of org.jitterbit.crypto.pgp.DecryptionResult.authenticationStatus()

            verificationKey = new StreamBasedKey(SENDER_PUBLIC_KEY);
            byte[] encrypted = encryptor.signAndEncrypt(CLEAR_TEXT.getBytes("UTF-8"), encryptingKey, false,
                            signatureKey, signKeyPassword);
            decryptor.setVerificationKey(verificationKey);
            DecryptionResult result = decryptor.decrypt(encrypted, decryptingKey, RECEIVER_PASSWORD);
            assertSame(expectedAuthStatus, result.authenticationStatus());
            assertSame(MessageIntegrity.INTEGRITY_VERIFIED, result.messageIntegrity());
            assertEquals(CLEAR_TEXT, new String(result.message(), "UTF-8"));
        } catch (Exception ex) {
            fail();
        } finally {
View Full Code Here

Examples of org.jitterbit.crypto.pgp.FileDecryptionResult.authenticationStatus()

        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

Examples of org.jitterbit.crypto.pgp.FileDecryptionResult.authenticationStatus()

        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
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.