Top Inners Constructors Methods
org.keycloak.jose.jwe.enc

public abstract Class AesCbcHmacShaEncryptionProvider

extends Object
implements JWEEncryptionProvider
Class Inheritance
All Implemented Interfaces
org.keycloak.jose.jwe.enc.JWEEncryptionProvider
Known Direct Subclasses
org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.Aes128CbcHmacSha256Provider, org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.Aes192CbcHmacSha384Provider, org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.Aes256CbcHmacSha512Provider, org.keycloak.jose.jwe.enc.AesCbcHmacShaJWEEncryptionProvider
Imports
java.io.IOException, java.nio.ByteBuffer, .ByteOrder, java.nio.charset.StandardCharsets, java.security.GeneralSecurityException, .InvalidKeyException, .Key, .MessageDigest, .NoSuchAlgorithmException, java.security.spec.AlgorithmParameterSpec, java.util.Arrays, javax.crypto.Cipher, .Mac, javax.crypto.spec.IvParameterSpec, .SecretKeySpec, org.keycloak.common.crypto.CryptoIntegration, org.keycloak.jose.jwe.JWE, .JWEKeyStorage, .JWEUtils

Author
Marek Posolda

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private byte[]
computeAuthenticationTag(byte[] aadBytes, byte[] ivBytes, byte[] cipherBytes, Key hmacKeySpec)

private byte[]
decryptBytes(byte[] encryptedBytes, byte[] ivBytes, Key aesKey)

public void
deserializeCEK(JWEKeyStorage keyStorage)

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.deserializeCEK.

This method is supposed to deserialize keys.
public void
encodeJwe(JWE jwe)

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.encodeJwe.

This method usually has 3 outputs: - generated initialization vector - encrypted content - authenticationTag for MAC validation It is supposed to call JWE#setEncryptedContentInfo(byte[], byte[], byte[]) after it's finished
private byte[]
encryptBytes(byte[] contentBytes, byte[] ivBytes, Key aesKey)

protected abstract int
protected abstract int
protected abstract String
public byte[]
serializeCEK(JWEKeyStorage keyStorage)

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.serializeCEK.

This method requires that decoded CEK keys are present in the keyStorage.decodedCEK map before it's called
public void
verifyAndDecodeJwe(JWE jwe)

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.verifyAndDecodeJwe.

This method is supposed to verify checksums and decrypt content.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AesCbcHmacShaEncryptionProviderback to summary
public AesCbcHmacShaEncryptionProvider()

Method Detail

computeAuthenticationTagback to summary
private byte[] computeAuthenticationTag(byte[] aadBytes, byte[] ivBytes, byte[] cipherBytes, Key hmacKeySpec) throws NoSuchAlgorithmException, InvalidKeyException
decryptBytesback to summary
private byte[] decryptBytes(byte[] encryptedBytes, byte[] ivBytes, Key aesKey) throws GeneralSecurityException
deserializeCEKback to summary
public void deserializeCEK(JWEKeyStorage keyStorage)

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.deserializeCEK.

Doc from org.keycloak.jose.jwe.enc.JWEEncryptionProvider.deserializeCEK.

This method is supposed to deserialize keys. It requires that JWEKeyStorage#getCekBytes() is set. After keys are deserialized, this method needs to call JWEKeyStorage#setCEKKey(Key, JWEKeyStorage.KeyUse) according to all uses, which this encryption algorithm requires.

Annotations
@Override
encodeJweback to summary
public void encodeJwe(JWE jwe) throws IOException, GeneralSecurityException

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.encodeJwe.

Doc from org.keycloak.jose.jwe.enc.JWEEncryptionProvider.encodeJwe.

This method usually has 3 outputs: - generated initialization vector - encrypted content - authenticationTag for MAC validation It is supposed to call JWE#setEncryptedContentInfo(byte[], byte[], byte[]) after it's finished

Annotations
@Override
encryptBytesback to summary
private byte[] encryptBytes(byte[] contentBytes, byte[] ivBytes, Key aesKey) throws GeneralSecurityException
getAuthenticationTagLengthback to summary
protected abstract int getAuthenticationTagLength()
getExpectedAesKeyLengthback to summary
protected abstract int getExpectedAesKeyLength()
getHmacShaAlgorithmback to summary
protected abstract String getHmacShaAlgorithm()
serializeCEKback to summary
public byte[] serializeCEK(JWEKeyStorage keyStorage)

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.serializeCEK.

Doc from org.keycloak.jose.jwe.enc.JWEEncryptionProvider.serializeCEK.

This method requires that decoded CEK keys are present in the keyStorage.decodedCEK map before it's called

Annotations
@Override
verifyAndDecodeJweback to summary
public void verifyAndDecodeJwe(JWE jwe) throws IOException, GeneralSecurityException

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.verifyAndDecodeJwe.

Doc from org.keycloak.jose.jwe.enc.JWEEncryptionProvider.verifyAndDecodeJwe.

This method is supposed to verify checksums and decrypt content. Then it needs to call JWE#content(byte[]) after it's finished

Annotations
@Override
org.keycloak.jose.jwe.enc back to summary

public Class AesCbcHmacShaEncryptionProvider.Aes128CbcHmacSha256Provider

extends AesCbcHmacShaEncryptionProvider
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected int
protected int
public int
protected String
Inherited from org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider:
deserializeCEKencodeJweserializeCEKverifyAndDecodeJwe

Constructor Detail

Aes128CbcHmacSha256Providerback to summary
public Aes128CbcHmacSha256Provider()

Method Detail

getAuthenticationTagLengthback to summary
protected int getAuthenticationTagLength()

Implements abstract org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.getAuthenticationTagLength.

Annotations
@Override
getExpectedAesKeyLengthback to summary
protected int getExpectedAesKeyLength()

Implements abstract org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.getExpectedAesKeyLength.

Annotations
@Override
getExpectedCEKLengthback to summary
public int getExpectedCEKLength()

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.getExpectedCEKLength.

Annotations
@Override
getHmacShaAlgorithmback to summary
protected String getHmacShaAlgorithm()

Implements abstract org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.getHmacShaAlgorithm.

Annotations
@Override
org.keycloak.jose.jwe.enc back to summary

public Class AesCbcHmacShaEncryptionProvider.Aes192CbcHmacSha384Provider

extends AesCbcHmacShaEncryptionProvider
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected int
protected int
public int
protected String
Inherited from org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider:
deserializeCEKencodeJweserializeCEKverifyAndDecodeJwe

Constructor Detail

Aes192CbcHmacSha384Providerback to summary
public Aes192CbcHmacSha384Provider()

Method Detail

getAuthenticationTagLengthback to summary
protected int getAuthenticationTagLength()

Implements abstract org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.getAuthenticationTagLength.

Annotations
@Override
getExpectedAesKeyLengthback to summary
protected int getExpectedAesKeyLength()

Implements abstract org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.getExpectedAesKeyLength.

Annotations
@Override
getExpectedCEKLengthback to summary
public int getExpectedCEKLength()

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.getExpectedCEKLength.

Annotations
@Override
getHmacShaAlgorithmback to summary
protected String getHmacShaAlgorithm()

Implements abstract org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.getHmacShaAlgorithm.

Annotations
@Override
org.keycloak.jose.jwe.enc back to summary

public Class AesCbcHmacShaEncryptionProvider.Aes256CbcHmacSha512Provider

extends AesCbcHmacShaEncryptionProvider
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected int
protected int
public int
protected String
Inherited from org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider:
deserializeCEKencodeJweserializeCEKverifyAndDecodeJwe

Constructor Detail

Aes256CbcHmacSha512Providerback to summary
public Aes256CbcHmacSha512Provider()

Method Detail

getAuthenticationTagLengthback to summary
protected int getAuthenticationTagLength()

Implements abstract org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.getAuthenticationTagLength.

Annotations
@Override
getExpectedAesKeyLengthback to summary
protected int getExpectedAesKeyLength()

Implements abstract org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.getExpectedAesKeyLength.

Annotations
@Override
getExpectedCEKLengthback to summary
public int getExpectedCEKLength()

Implements org.keycloak.jose.jwe.enc.JWEEncryptionProvider.getExpectedCEKLength.

Annotations
@Override
getHmacShaAlgorithmback to summary
protected String getHmacShaAlgorithm()

Implements abstract org.keycloak.jose.jwe.enc.AesCbcHmacShaEncryptionProvider.getHmacShaAlgorithm.

Annotations
@Override