45 jwe.setEncodedHeader(jwe.getHeader().toBase64JsonObject());
48 SecureRandom random =
new SecureRandom();
49 random.nextBytes(contentMasterKey);
52 jwe.setEncodedEncryptedKey(encodedEncryptedKey);
55 random.nextBytes(initializationVector);
56 String encodedInitializationVector = Base64Util.base64urlencode(initializationVector);
57 jwe.setEncodedInitializationVector(encodedInitializationVector);
60 jwe.getAdditionalAuthenticatedData().getBytes(Util.UTF8_STRING_ENCODING),
61 jwe.getClaims().toBase64JsonObject().getBytes(Util.UTF8_STRING_ENCODING));
62 jwe.setEncodedCiphertext(result.getFirst());
63 jwe.setEncodedIntegrityValue(result.getSecond());
66 }
catch (InvalidJwtException e) {
67 throw new InvalidJweException(e);
68 }
catch (UnsupportedEncodingException e) {
69 throw new InvalidJweException(e);
int getInitVectorLength()
Definition: BlockEncryptionAlgorithm.java:75
abstract String generateEncryptedKey(byte[] contentMasterKey)
abstract Pair< String, String > generateCipherTextAndIntegrityValue(byte[] contentMasterKey, byte[] initializationVector, byte[] additionalAuthenticatedData, byte[] plainText)
int getCmkLength()
Definition: BlockEncryptionAlgorithm.java:71
BlockEncryptionAlgorithm blockEncryptionAlgorithm
Definition: AbstractJweEncrypter.java:27