Package org.jboss.aerogear.crypto.signature

Examples of org.jboss.aerogear.crypto.signature.VerifyKey


    @Test
    public void testSignMessageAsBytes() throws Exception {
        SigningKey key = new SigningKey();
        byte[] signMessage = HEX.decode(SIGN_MESSAGE);
        byte[] signedMessage = key.sign(HEX.decode(SIGN_MESSAGE));
        VerifyKey verifyKey = new VerifyKey(key.getPublicKey());
        Boolean isValid = verifyKey.verify(signMessage, signedMessage);
        assertTrue("Message sign has failed", isValid);
    }
View Full Code Here


    @Test
    public void testSignMessageAsHex() throws Exception {
        SigningKey key = new SigningKey();
        String signedMessage = key.sign(SIGN_MESSAGE, HEX);
        VerifyKey verifyKey = new VerifyKey(key.getPublicKey());
        Boolean isValid = verifyKey.verify(SIGN_MESSAGE, signedMessage, HEX);
        assertTrue("Message sign has failed", isValid);
    }
View Full Code Here

    public void testVerifyCorruptedSignature() throws Exception {
        SigningKey key = new SigningKey();
        byte[] signMessage = HEX.decode(SIGN_MESSAGE);
        byte[] corruptedSignature = key.sign(signMessage);
        corruptedSignature[0] = ' ';
        VerifyKey verifyKey = new VerifyKey(key.getPublicKey());
        Boolean isValid = verifyKey.verify(signMessage, corruptedSignature);
        assertTrue("Message sign has failed", isValid);
    }
View Full Code Here

    public void testVerifyCorruptedMessage() throws Exception {
        SigningKey key = new SigningKey();
        byte[] signMessage = HEX.decode(SIGN_MESSAGE);
        byte[] signature = key.sign(HEX.decode(SIGN_MESSAGE));
        signMessage[0] = ' ';
        VerifyKey verifyKey = new VerifyKey(key.getPublicKey());
        Boolean isValid = verifyKey.verify(signMessage, signature);
        assertFalse("Message should be invalid", isValid);
    }
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.crypto.signature.VerifyKey

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.