org.apache.cxf.rs.security.jose.jwe
Class AbstractJweEncryption

java.lang.Object
  extended by org.apache.cxf.rs.security.jose.jwe.AbstractJweEncryption
All Implemented Interfaces:
JweEncryptionProvider, JweKeyProperties
Direct Known Subclasses:
AesCbcHmacJweEncryption, DirectKeyJweEncryption, WrappedKeyJweEncryption

public abstract class AbstractJweEncryption
extends Object
implements JweEncryptionProvider


Nested Class Summary
protected static class AbstractJweEncryption.JweEncryptionInternal
           
 
Field Summary
protected static int DEFAULT_AUTH_TAG_LENGTH
           
 
Constructor Summary
protected AbstractJweEncryption(ContentEncryptionAlgorithm contentEncryptionAlgo, KeyEncryptionAlgorithm keyEncryptionAlgo)
           
 
Method Summary
protected  SecretKey createCekSecretKey(AbstractJweEncryption.JweEncryptionInternal state)
           
 JweEncryptionState createJweEncryptionState(JweEncryptionInput jweInput)
          Prepare JWE state for completing either JWE compact or JSON encryption
 String encrypt(byte[] content, JweHeaders jweHeaders)
          JWE compact encryption
protected  byte[] getAAD(String protectedHeaders, byte[] aad)
           
protected  byte[] getActualCek(byte[] theCek, String algoJwt)
           
protected  AlgorithmParameterSpec getAlgorithmParameterSpec(byte[] theIv)
           
protected  AuthenticationTagProducer getAuthenticationTagProducer(AbstractJweEncryption.JweEncryptionInternal state)
           
protected  int getCekSize(String algoJwt)
           
 String getContentAlgorithm()
           
protected  String getContentEncryptionAlgoJava()
           
protected  String getContentEncryptionAlgoJwt()
           
protected  ContentEncryptionAlgorithm getContentEncryptionAlgorithm()
           
protected  byte[] getContentEncryptionKey(JweHeaders headers)
           
protected  byte[] getEncryptedContentEncryptionKey(JweHeaders headers, byte[] theCek)
           
protected  JweCompactProducer getJweCompactProducer(AbstractJweEncryption.JweEncryptionInternal state, byte[] cipher)
           
protected  JoseHeadersReaderWriter getJwtHeadersWriter()
           
 String getKeyAlgorithm()
           
protected  KeyEncryptionAlgorithm getKeyEncryptionAlgo()
           
protected  byte[] getProvidedContentEncryptionKey(JweHeaders headers)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_AUTH_TAG_LENGTH

protected static final int DEFAULT_AUTH_TAG_LENGTH
See Also:
Constant Field Values
Constructor Detail

AbstractJweEncryption

protected AbstractJweEncryption(ContentEncryptionAlgorithm contentEncryptionAlgo,
                                KeyEncryptionAlgorithm keyEncryptionAlgo)
Method Detail

getContentEncryptionAlgorithm

protected ContentEncryptionAlgorithm getContentEncryptionAlgorithm()

getAlgorithmParameterSpec

protected AlgorithmParameterSpec getAlgorithmParameterSpec(byte[] theIv)

getContentEncryptionKey

protected byte[] getContentEncryptionKey(JweHeaders headers)

getCekSize

protected int getCekSize(String algoJwt)

getProvidedContentEncryptionKey

protected byte[] getProvidedContentEncryptionKey(JweHeaders headers)

getEncryptedContentEncryptionKey

protected byte[] getEncryptedContentEncryptionKey(JweHeaders headers,
                                                  byte[] theCek)

getContentEncryptionAlgoJwt

protected String getContentEncryptionAlgoJwt()

getContentEncryptionAlgoJava

protected String getContentEncryptionAlgoJava()

getAAD

protected byte[] getAAD(String protectedHeaders,
                        byte[] aad)

encrypt

public String encrypt(byte[] content,
                      JweHeaders jweHeaders)
Description copied from interface: JweEncryptionProvider
JWE compact encryption

Specified by:
encrypt in interface JweEncryptionProvider

getJweCompactProducer

protected JweCompactProducer getJweCompactProducer(AbstractJweEncryption.JweEncryptionInternal state,
                                                   byte[] cipher)

getKeyAlgorithm

public String getKeyAlgorithm()
Specified by:
getKeyAlgorithm in interface JweKeyProperties

getContentAlgorithm

public String getContentAlgorithm()
Specified by:
getContentAlgorithm in interface JweKeyProperties

getJwtHeadersWriter

protected JoseHeadersReaderWriter getJwtHeadersWriter()

createJweEncryptionState

public JweEncryptionState createJweEncryptionState(JweEncryptionInput jweInput)
Description copied from interface: JweEncryptionProvider
Prepare JWE state for completing either JWE compact or JSON encryption

Specified by:
createJweEncryptionState in interface JweEncryptionProvider

getAuthenticationTagProducer

protected AuthenticationTagProducer getAuthenticationTagProducer(AbstractJweEncryption.JweEncryptionInternal state)

createCekSecretKey

protected SecretKey createCekSecretKey(AbstractJweEncryption.JweEncryptionInternal state)

getActualCek

protected byte[] getActualCek(byte[] theCek,
                              String algoJwt)

getKeyEncryptionAlgo

protected KeyEncryptionAlgorithm getKeyEncryptionAlgo()


Apache CXF