Examples of base64UrlEncode()


Examples of org.jose4j.base64url.Base64Url.base64UrlEncode()

        Headers receivedHeaders = new Headers();
        receivedHeaders.setFullHeaderAsJsonString(headers.getFullHeaderAsJsonString());

        Key key = ecdhKeyAgreementAlgorithm.manageForDecrypt(receiverJwk.getPrivateKey(), null, cekDesc, receivedHeaders);
        assertEquals("VqqN6vgjbSBcIijNcacQGg", base64Url.base64UrlEncode(key.getEncoded()));
    }

        public void testDV256() throws JoseException
        {
        /*
 
View Full Code Here

Examples of org.jose4j.base64url.Base64Url.base64UrlEncode()

                Base64Url base64Url = new Base64Url();

                byte[] ciphertext = encryptionParts.getCiphertext();
                String encodedJweCiphertext = "5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6jiSdiwkIr3ajwQzaBtQD_A";
                assertThat(encodedJweCiphertext, equalTo(base64Url.base64UrlEncode(ciphertext)));

                byte[] authenticationTag = encryptionParts.getAuthenticationTag();
                String encodedAuthenticationTag = "XFBoMYUZodetZdvTiFvSkQ";
                assertThat(encodedAuthenticationTag, equalTo(base64Url.base64UrlEncode(authenticationTag)));
View Full Code Here

Examples of org.jose4j.base64url.Base64Url.base64UrlEncode()

                String encodedJweCiphertext = "5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6jiSdiwkIr3ajwQzaBtQD_A";
                assertThat(encodedJweCiphertext, equalTo(base64Url.base64UrlEncode(ciphertext)));

                byte[] authenticationTag = encryptionParts.getAuthenticationTag();
                String encodedAuthenticationTag = "XFBoMYUZodetZdvTiFvSkQ";
                assertThat(encodedAuthenticationTag, equalTo(base64Url.base64UrlEncode(authenticationTag)));

                ContentEncryptionParts parts = new ContentEncryptionParts(iv, ciphertext, authenticationTag);
                byte[] decrypted = aesGcmContentEncryptionAlg.decrypt(parts, aad, cek, null);
                assertArrayEquals(plainText, decrypted);
            }
View Full Code Here

Examples of org.jose4j.base64url.Base64Url.base64UrlEncode()

        byte[] expectedEncryptedKey = ByteUtil.convertUnsignedToSignedTwosComp(new int[]{78, 186, 151, 59, 11, 141, 81, 240, 213, 245, 83, 211, 53, 188,
                                        134, 188, 66, 125, 36, 200, 222, 124, 5, 103, 249, 52, 117, 184, 140,
                                        81, 246, 158, 161, 177, 20, 33, 245, 57, 59, 4});

        byte[] encryptedKey = contentEncryptionKeys.getEncryptedKey();
        String encodedEncryptedKey = base64url.base64UrlEncode(encryptedKey);
        assertArrayEquals(expectedEncryptedKey, encryptedKey);

        String encodedIv = "Ye9j1qs22DmRSAddIh-VnA";
        byte[] iv = base64url.base64UrlDecode(encodedIv);
View Full Code Here

Examples of org.jose4j.base64url.Base64Url.base64UrlEncode()

        AesCbcHmacSha2ContentEncryptionAlgorithm aes128CbcHmacSha256 = new AesCbcHmacSha2ContentEncryptionAlgorithm.Aes128CbcHmacSha256();
        byte[] aad = StringUtil.getBytesAscii(encodedHeader);
        ContentEncryptionParts contentEncryptionParts = aes128CbcHmacSha256.encrypt(plainTextOctetsAsBytes, aad, contentEncryptionKey, iv);
        byte[] authenticationTag = contentEncryptionParts.getAuthenticationTag();
        String encodedTag = base64url.base64UrlEncode(authenticationTag);
        byte[] ciphertext = contentEncryptionParts.getCiphertext();
        String encodedCiphertext = base64url.base64UrlEncode(ciphertext);

        String cs = CompactSerializer.serialize(encodedHeader, encodedEncryptedKey, encodedIv, encodedCiphertext, encodedTag);
        assertThat(CS, is(equalTo(cs)));
View Full Code Here

Examples of org.jose4j.base64url.Base64Url.base64UrlEncode()

        byte[] aad = StringUtil.getBytesAscii(encodedHeader);
        ContentEncryptionParts contentEncryptionParts = aes128CbcHmacSha256.encrypt(plainTextOctetsAsBytes, aad, contentEncryptionKey, iv);
        byte[] authenticationTag = contentEncryptionParts.getAuthenticationTag();
        String encodedTag = base64url.base64UrlEncode(authenticationTag);
        byte[] ciphertext = contentEncryptionParts.getCiphertext();
        String encodedCiphertext = base64url.base64UrlEncode(ciphertext);

        String cs = CompactSerializer.serialize(encodedHeader, encodedEncryptedKey, encodedIv, encodedCiphertext, encodedTag);
        assertThat(CS, is(equalTo(cs)));
    }
}
View Full Code Here

Examples of org.jose4j.base64url.Base64Url.base64UrlEncode()

        Base64Url base64Url = new Base64Url();

        byte[] ciphertext = contentEncryptionParts.getCiphertext();
        String encodedJweCiphertext = "KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY";
        assertEquals(encodedJweCiphertext, base64Url.base64UrlEncode(ciphertext));

        byte[] authenticationTag = contentEncryptionParts.getAuthenticationTag();
        String encodedAuthenticationTag = "9hH0vgRfYgPnAHOd8stkvw";
        assertEquals(encodedAuthenticationTag, base64Url.base64UrlEncode(authenticationTag));
    }
View Full Code Here

Examples of org.jose4j.base64url.Base64Url.base64UrlEncode()

        String encodedJweCiphertext = "KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY";
        assertEquals(encodedJweCiphertext, base64Url.base64UrlEncode(ciphertext));

        byte[] authenticationTag = contentEncryptionParts.getAuthenticationTag();
        String encodedAuthenticationTag = "9hH0vgRfYgPnAHOd8stkvw";
        assertEquals(encodedAuthenticationTag, base64Url.base64UrlEncode(authenticationTag));
    }

    public void testExampleDecryptFromJweAppendix2() throws JoseException
    {
        int[] ints = {4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106, 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156, 44, 207};
View Full Code Here

Examples of org.jose4j.base64url.Base64Url.base64UrlEncode()

        byte[] saltInput;
        Base64Url base64Url = new Base64Url();
        if (saltInputString == null)
        {
            saltInput = ByteUtil.randomBytes(defaultSaltByteLength);
            saltInputString = base64Url.base64UrlEncode(saltInput);
            headers.setStringHeaderValue(HeaderParameterNames.PBES2_SALT_INPUT, saltInputString);
        }
        else
        {
            saltInput = base64Url.base64UrlDecode(saltInputString);
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.