Examples of base64UrlEncode()


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

    protected void fillTypeSpecificParams(Map<String, Object> params, OutputControlLevel outputLevel)
    {
        if (OutputControlLevel.INCLUDE_SYMMETRIC.compareTo(outputLevel) >= 0)
        {
            Base64Url base64Url = new Base64Url();
            String encodedBytes = base64Url.base64UrlEncode(octetSequence);
            params.put(KEY_VALUE_MEMBER_NAME, encodedBytes);
        }
    }
}
View Full Code Here

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

        String encodedIv = headers.getStringHeaderValue(HeaderParameterNames.INITIALIZATION_VECTOR);
        byte[] iv;
        if (encodedIv == null)
        {
            iv = ByteUtil.randomBytes(IV_BYTE_LENGTH);
            encodedIv = base64Url.base64UrlEncode(iv);
            headers.setStringHeaderValue(HeaderParameterNames.INITIALIZATION_VECTOR, encodedIv);
        }
        else
        {
            iv = base64Url.base64UrlDecode(encodedIv);
View Full Code Here

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

        SimpleAeadCipher.CipherOutput encrypted = simpleAeadCipher.encrypt(managementKey, iv, cek, null);
        byte[] encryptedKey = encrypted.getCiphertext();
        byte[] tag = encrypted.getTag();

        String encodedTag = base64Url.base64UrlEncode(tag);
        headers.setStringHeaderValue(HeaderParameterNames.AUTHENTICATION_TAG, encodedTag);

        return new ContentEncryptionKeys(cek, encryptedKey);
    }
View Full Code Here

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

    }

    public static String toDebugString(byte[] bytes)
    {
        Base64Url base64Url = new Base64Url();
        String s = base64Url.base64UrlEncode(bytes);
        int[] ints = convertSignedTwosCompToUnsigned(bytes);
        return Arrays.toString(ints) + "("+ints.length+"bytes/"+bitLength(ints.length)+"bits) | base64url encoded: " + s;
    }

}
View Full Code Here

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

    public static String toBase64Url(BigInteger bigInteger)
    {
        Base64Url base64Url = new Base64Url();
        byte[] bytes = toByteArray(bigInteger);
        return base64Url.base64UrlEncode(bytes);
    }

    public static String toBase64Url(BigInteger bigInteger, int minByteArrayLength)
    {
        Base64Url base64Url = new Base64Url();
View Full Code Here

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

    public static String toBase64Url(BigInteger bigInteger, int minByteArrayLength)
    {
        Base64Url base64Url = new Base64Url();
        byte[] bytes = toByteArray(bigInteger, minByteArrayLength);
        return base64Url.base64UrlEncode(bytes);
    }
}
View Full Code Here

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

        calculatedAuthenticationTag = ByteUtil.subArray(calculatedAuthenticationTag, 0, getTagTruncationLength()); // truncate it
        boolean tagMatch = ByteUtil.secureEquals(authenticationTag, calculatedAuthenticationTag);
        if (!tagMatch)
        {
            Base64Url base64Url = new Base64Url();
            String encTag = base64Url.base64UrlEncode(authenticationTag);
            String calcEncTag = base64Url.base64UrlEncode(calculatedAuthenticationTag);
            throw new IntegrityException("Authentication tag check failed. Message=" + encTag + " calculated=" + calcEncTag);
        }

        Key encryptionKey = new AesKey(ByteUtil.rightHalf(contentEncryptionKey));
View Full Code Here

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

        boolean tagMatch = ByteUtil.secureEquals(authenticationTag, calculatedAuthenticationTag);
        if (!tagMatch)
        {
            Base64Url base64Url = new Base64Url();
            String encTag = base64Url.base64UrlEncode(authenticationTag);
            String calcEncTag = base64Url.base64UrlEncode(calculatedAuthenticationTag);
            throw new IntegrityException("Authentication tag check failed. Message=" + encTag + " calculated=" + calcEncTag);
        }

        Key encryptionKey = new AesKey(ByteUtil.rightHalf(contentEncryptionKey));
View Full Code Here

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

        ContentEncryptionKeys contentEncryptionKeys = wrappingKeyManagementAlgorithm.manageForEnc(managementKey, cekDesc, cekBytes);

        String encodedEncryptedKeyFromExample ="6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ";

        Base64Url u = new Base64Url();
        String encodedWrapped = u.base64UrlEncode(contentEncryptionKeys.getEncryptedKey());

        assertEquals(encodedEncryptedKeyFromExample, encodedWrapped);

        byte[] encryptedKey = u.base64UrlDecode(encodedEncryptedKeyFromExample);
View Full Code Here

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

        PublicKey pubKey = receiverJwk.getPublicKey();
        ContentEncryptionKeys contentEncryptionKeys = ecdhKeyAgreementAlgorithm.manageForEncrypt(pubKey, cekDesc, headers, ephemeralJwk);

        assertTrue(contentEncryptionKeys.getEncryptedKey().length == 0);
        Base64Url base64Url = new Base64Url();
        assertEquals("VqqN6vgjbSBcIijNcacQGg", base64Url.base64UrlEncode(contentEncryptionKeys.getContentEncryptionKey()));

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

        Key key = ecdhKeyAgreementAlgorithm.manageForDecrypt(receiverJwk.getPrivateKey(), null, cekDesc, receivedHeaders);
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.