public class Encrypter extends Encrypter
EncryptedElementType.
Overloaded methods are provided for encrypting various SAML 2 elements to their corresponding encrypted element
variant of EncryptedElementType.
Support is also provided for differing placement options for any associated EncryptedKeys that may be generated. The options are:
INLINE: EncryptedKeys will placed inside the KeyInfo element of the EncryptedData elementPEER: EncryptedKeys will be placed as peer elements of the EncryptedData inside the
EncryptedElementType elementPEER.
The EncryptedKey forward and back referencing behavior associated with these key placement options is intended to be consistent with the guidelines detailed in SAML 2 Errata E43. See that document for further information.
For information on other parameters and options, and general XML Encryption issues, see
Encrypter.
| Modifier and Type | Class and Description |
|---|---|
static class |
Encrypter.KeyPlacement
Options for where to place the resulting EncryptedKey elements with respect to the associated EncryptedData
element.
|
| Modifier and Type | Field and Description |
|---|---|
private org.opensaml.core.xml.XMLObjectBuilderFactory |
builderFactory
Factory for building XMLObject instances.
|
private XMLEncryptionBuilder<CarriedKeyName> |
carriedKeyNameBuilder
Builder for CarriedKeyName objects.
|
private XMLEncryptionBuilder<DataReference> |
dataReferenceBuilder
Builder for DataReference objects.
|
private DataEncryptionParameters |
encParams
The parameters to use for encrypting the data.
|
private net.shibboleth.utilities.java.support.security.IdentifierGenerationStrategy |
idGenerator
Generator for XML ID attribute values.
|
private List<KeyEncryptionParameters> |
kekParamsList
The parameters to use for encrypting (wrapping) the data encryption key.
|
private XMLSignatureBuilder<KeyInfo> |
keyInfoBuilder
Builder for KeyInfo objects.
|
private XMLSignatureBuilder<KeyName> |
keyNameBuilder
Builder for KeyName objects.
|
private Encrypter.KeyPlacement |
keyPlacement
The option for where to place the generated EncryptedKey elements.
|
private Logger |
log
Class logger.
|
private XMLEncryptionBuilder<ReferenceList> |
referenceListBuilder
Builder for ReferenceList objects.
|
private XMLSignatureBuilder<RetrievalMethod> |
retrievalMethodBuilder
Builder for RetrievalMethod objects.
|
| Constructor and Description |
|---|
Encrypter(DataEncryptionParameters dataEncParams)
Constructor.
|
Encrypter(DataEncryptionParameters dataEncParams,
KeyEncryptionParameters keyEncParam)
Constructor.
|
Encrypter(DataEncryptionParameters dataEncParams,
List<KeyEncryptionParameters> keyEncParams)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
EncryptedAssertion |
encrypt(Assertion assertion)
Encrypt the specified Assertion.
|
EncryptedAttribute |
encrypt(Attribute attribute)
Encrypt the specified Attribute.
|
EncryptedID |
encrypt(BaseID baseID)
Encrypt the specified BaseID.
|
EncryptedID |
encrypt(NameID nameID)
Encrypt the specified NameID.
|
NewEncryptedID |
encrypt(NewID newID)
Encrypt the specified NewID.
|
private EncryptedElementType |
encrypt(org.opensaml.core.xml.XMLObject xmlObject,
QName encElementName)
Encrypt the specified XMLObject, and return it as an instance of the specified QName, which should be one of the
types derived from
EncryptedElementType. |
EncryptedID |
encryptAsID(Assertion assertion)
Encrypt the specified Assertion, treating as an identifier and returning an EncryptedID.
|
Encrypter.KeyPlacement |
getKeyPlacement()
Get the current key placement option.
|
private void |
init()
Helper method for constructors.
|
protected void |
linkMultiplePeerKeys(EncryptedData encData,
List<EncryptedKey> encKeys)
Link multiple "multicast" EncryptedKeys to the EncryptedData according to guidelines in SAML Errata E43.
|
protected void |
linkSinglePeerKey(EncryptedData encData,
EncryptedKey encKey)
Link a single EncryptedKey to the EncryptedData according to guidelines in SAML Errata E43.
|
private void |
logPreEncryption(org.opensaml.core.xml.XMLObject xmlObject,
String objectType)
Log the target object prior to encryption.
|
protected EncryptedElementType |
placeKeysAsPeers(EncryptedElementType encElement,
EncryptedData encData,
List<EncryptedKey> encKeys)
Store the specified EncryptedData and EncryptedKey(s) in the specified instance of EncryptedElementType as peer
elements, following SAML 2 Errata E43 guidelines for forward and back referencing between the EncryptedData and
EncryptedKey(s).
|
protected EncryptedElementType |
placeKeysInline(EncryptedElementType encElement,
EncryptedData encData,
List<EncryptedKey> encKeys)
Place the EncryptedKey elements inside the KeyInfo element within the EncryptedData element.
|
protected EncryptedElementType |
processElements(EncryptedElementType encElement,
EncryptedData encData,
List<EncryptedKey> encKeys)
Handle post-processing of generated EncryptedData and EncryptedKey(s) and storage in the appropriate
EncryptedElementType instance.
|
void |
setIDGenerator(net.shibboleth.utilities.java.support.security.IdentifierGenerationStrategy newIDGenerator)
Set the generator to use when creating XML ID attribute values.
|
void |
setKeyPlacement(Encrypter.KeyPlacement newKeyPlacement)
Set the key placement option.
|
buildXMLCipher, checkAndMarshall, checkParams, checkParams, checkParams, checkParams, decodeOAEPParams, encryptElement, encryptElement, encryptElement, encryptElement, encryptElementContent, encryptElementContent, encryptElementContent, encryptKey, encryptKey, encryptKey, generateEncryptionKey, getEffectiveMGF, getJCAProviderName, postProcessApacheEncryptedKey, setJCAProviderNameprivate org.opensaml.core.xml.XMLObjectBuilderFactory builderFactory
private XMLSignatureBuilder<KeyInfo> keyInfoBuilder
private XMLEncryptionBuilder<DataReference> dataReferenceBuilder
private XMLEncryptionBuilder<ReferenceList> referenceListBuilder
private XMLSignatureBuilder<RetrievalMethod> retrievalMethodBuilder
private XMLSignatureBuilder<KeyName> keyNameBuilder
private XMLEncryptionBuilder<CarriedKeyName> carriedKeyNameBuilder
private net.shibboleth.utilities.java.support.security.IdentifierGenerationStrategy idGenerator
private DataEncryptionParameters encParams
private List<KeyEncryptionParameters> kekParamsList
private Encrypter.KeyPlacement keyPlacement
private final Logger log
public Encrypter(DataEncryptionParameters dataEncParams, List<KeyEncryptionParameters> keyEncParams)
dataEncParams - the data encryption parameterskeyEncParams - the key encryption parameterspublic Encrypter(DataEncryptionParameters dataEncParams, KeyEncryptionParameters keyEncParam)
dataEncParams - the data encryption parameterskeyEncParam - the key encryption parameterpublic Encrypter(DataEncryptionParameters dataEncParams)
dataEncParams - the data encryption parametersprivate void init()
public void setIDGenerator(net.shibboleth.utilities.java.support.security.IdentifierGenerationStrategy newIDGenerator)
newIDGenerator - the new IdentifierGenerator to usepublic Encrypter.KeyPlacement getKeyPlacement()
public void setKeyPlacement(Encrypter.KeyPlacement newKeyPlacement)
newKeyPlacement - The new key placement option to setpublic EncryptedAssertion encrypt(Assertion assertion) throws EncryptionException
assertion - the Assertion to encryptEncryptionException - thrown when encryption generates an errorpublic EncryptedID encryptAsID(Assertion assertion) throws EncryptionException
assertion - the Assertion to encryptEncryptionException - thrown when encryption generates an errorpublic EncryptedAttribute encrypt(Attribute attribute) throws EncryptionException
attribute - the Attribute to encryptEncryptionException - thrown when encryption generates an errorpublic EncryptedID encrypt(NameID nameID) throws EncryptionException
nameID - the NameID to encryptEncryptionException - thrown when encryption generates an errorpublic EncryptedID encrypt(BaseID baseID) throws EncryptionException
baseID - the BaseID to encryptEncryptionException - thrown when encryption generates an errorpublic NewEncryptedID encrypt(NewID newID) throws EncryptionException
newID - the NewID to encryptEncryptionException - thrown when encryption generates an errorprivate void logPreEncryption(org.opensaml.core.xml.XMLObject xmlObject,
String objectType)
xmlObject - the XMLObject to encryptobjectType - String description of the type of object to encryptprivate EncryptedElementType encrypt(org.opensaml.core.xml.XMLObject xmlObject, QName encElementName) throws EncryptionException
EncryptedElementType.xmlObject - the XMLObject to encryptencElementName - the QName of the specialization of EncryptedElementType to returnEncryptedElementTypeEncryptionException - thrown when encryption generates an errorprotected EncryptedElementType processElements(EncryptedElementType encElement, EncryptedData encData, List<EncryptedKey> encKeys) throws EncryptionException
encElement - the EncryptedElementType instance which will hold the encrypted data and keysencData - the EncryptedData objectencKeys - the list of EncryptedKey objectsEncryptionException - thrown when processing encounters an errorprotected EncryptedElementType placeKeysInline(EncryptedElementType encElement, EncryptedData encData, List<EncryptedKey> encKeys)
encElement - the EncryptedElementType instance which will hold the encrypted data and keysencData - the EncryptedData objectencKeys - the list of EncryptedKey objectsprotected EncryptedElementType placeKeysAsPeers(EncryptedElementType encElement, EncryptedData encData, List<EncryptedKey> encKeys)
encElement - a specialization of EncryptedElementType to store the encrypted data and keysencData - the EncryptedData to storeencKeys - the EncryptedKey(s) to storeprotected void linkSinglePeerKey(EncryptedData encData, EncryptedKey encKey)
encData - the EncryptedDataencKey - the EncryptedKeyprotected void linkMultiplePeerKeys(EncryptedData encData, List<EncryptedKey> encKeys)
encData - the EncryptedDataencKeys - the list of EncryptedKeysCopyright © 1999–2020 Shibboleth Consortium. All rights reserved.