Package net.shibboleth.metadata.dom
Class XMLSignatureSigningStage
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.metadata.pipeline.AbstractStage<Element>
net.shibboleth.metadata.dom.XMLSignatureSigningStage
- All Implemented Interfaces:
Stage<Element>,net.shibboleth.shared.component.Component,net.shibboleth.shared.component.DestructableComponent,net.shibboleth.shared.component.IdentifiableComponent,net.shibboleth.shared.component.IdentifiedComponent,net.shibboleth.shared.component.InitializableComponent
A pipeline stage that creates, and adds, an enveloped signature for each element in the given
DOMElementItem
collection.
This stage requires the following properties be set prior to initialization:
privateKey
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe variant of SHA to use in the various signature algorithms. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether to use exclusive canonicalization.private booleanWhether to include comments in the canonicalized data.private List<X509Certificate>Certificate chain, with end entity certificate as element 0, to be included with the signature.CRLs to be included with the signature.private booleanWhether to debug digest operations by logging the pre-digest data stream.Names of attributes to treat as ID attributes for signature referencing.private booleanWhether key names should be included in the signature's KeyInfo.private booleanWhether the public key should be included in the signature's KeyInfo.private booleanWhether the certificates chain should be included in the signature's KeyInfo.private booleanWhether the CRLs should be included in the signature's KeyInfo.private booleanWhether the end-entity certificate's issuer and serial number should be included in the signature's KeyInfo.private booleanWhether the end-entity certificate's subject name should be included in the signature's KeyInfo.Inclusive prefix list used with exclusive canonicalization.Explicit names to associate with the given signing key.private static final org.slf4j.LoggerClass logger.private PrivateKeyPrivate key used to sign data.private PublicKeyPublic key associated with the given private key.private booleanWhether to remove CR characters from generated signatures.SHA algorithm variant used in signature and digest algorithms. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerforms the stage processing on the given Item collection.protected voidfinal List<X509Certificate>Gets the certificates associated with the key used to sign the content.getCrls()Gets the CRLs associated with certificates.Gets the names of the attributes treated as reference IDs.Gets the inclusive prefix list used during exclusive canonicalization.Gets the explicit key names added to the KeyInfo.final PrivateKeyGets the private key used to sign the content.final PublicKeyGets the public key associated with private key used to sign the content.Deprecated, for removal: This API element is subject to removal in a future version.Gets the SHA algorithm variant used when computing the signature and digest.final booleanGets whether exclusive canonicalization will be used.final booleanGets whether comments are canonicalized.final booleanGets whether logging of the pre-digest data stream is enabled.final booleanGets whether key names are included in the KeyInfo.final booleanGets whether key values are included in the KeyInfo.final booleanGets whether X509 certificates are included in the KeyInfo.final booleanGets whether CRLs are included in the KeyInfo.final booleanGets whether the end-entity certificate's issuer and serial number are included in the KeyInfo.final booleanGets whether end-entity certifcate's subject name is included in the KeyInfo.final booleanGets whether CR characters will be removed from generated signatures.voidsetC14nExclusive(boolean isExclusive) Sets whether exclusive canonicalization will be used.voidsetC14nWithComments(boolean withComments) Sets whether comments are canonicalized.voidsetCertificates(List<X509Certificate> certs) Sets the certificates associated with the key used to sign the content.voidSets the CRLs associated with certificates.voidsetDebugPreDigest(boolean debug) Sets whether logging of the pre-digest data stream is enabled.voidsetIdAttributeNames(List<QName> names) Sets the names of the attributes treated as reference IDs.voidsetIncludeKeyNames(boolean include) Sets whether key names are included in the KeyInfo.voidsetIncludeKeyValue(boolean included) Sets whether key values are included in the KeyInfo.voidsetIncludeX509Certificates(boolean include) Sets whether X509 certificates are included in the KeyInfo.voidsetIncludeX509Crls(boolean include) Sets whether CRLs are included in the KeyInfo.voidsetIncludeX509IssuerSerial(boolean include) Sets whether the end-entity certificate's issuer and serial number are included in the KeyInfo.voidsetIncludeX509SubjectName(boolean include) Sets whether end-entity certifcate's subject name is included in the KeyInfo.voidsetInclusivePrefixList(List<String> prefixList) Sets the inclusive prefix list used during exclusive canonicalization.voidsetKeyNames(List<String> names) Sets the explicit key names added to the KeyInfo.voidsetPrivateKey(PrivateKey key) Sets the private key used to sign the content.voidsetPublicKey(PublicKey key) Sets public key associated with private key used to sign the content.final voidsetRemovingCRsFromSignature(boolean newValue) Sets whether to remove CR characters from generated signatures.voidDeprecated, for removal: This API element is subject to removal in a future version.voidSets the SHA algorithm variant used when computing the signature and digest.Methods inherited from class net.shibboleth.metadata.pipeline.AbstractStage
execute, getCollectionPredicate, setCollectionPredicateMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
LOG
@Nonnull private static final org.slf4j.Logger LOGClass logger. -
shaVariant
SHA algorithm variant used in signature and digest algorithms. Default value:SHAVariant.SHA256 -
privKey
Private key used to sign data. -
publicKey
Public key associated with the given private key. -
certificates
Certificate chain, with end entity certificate as element 0, to be included with the signature. Default value: empty list -
crls
CRLs to be included with the signature. Default value: empty list -
c14nExclusive
private boolean c14nExclusiveWhether to use exclusive canonicalization. Default value:true -
c14nWithComments
private boolean c14nWithCommentsWhether to include comments in the canonicalized data. Default value:false -
removingCRsFromSignature
private boolean removingCRsFromSignatureWhether to remove CR characters from generated signatures. Default value:true. -
inclusivePrefixList
Inclusive prefix list used with exclusive canonicalization. Default value: empty list -
idAttributeNames
Names of attributes to treat as ID attributes for signature referencing. Default value: list containing the non-namespace-qualified attributes 'ID', 'Id', 'id' -
keyNames
Explicit names to associate with the given signing key. Default value: empty list -
includeKeyNames
private boolean includeKeyNamesWhether key names should be included in the signature's KeyInfo. Default value:true -
includeKeyValue
private boolean includeKeyValueWhether the public key should be included in the signature's KeyInfo. The public key can be sourced from either thepublicKeyproperty or from the first provided certificate. Default value:false -
includeX509SubjectName
private boolean includeX509SubjectNameWhether the end-entity certificate's subject name should be included in the signature's KeyInfo. Default value:false -
includeX509Certificates
private boolean includeX509CertificatesWhether the certificates chain should be included in the signature's KeyInfo. Default value:true -
includeX509Crls
private boolean includeX509CrlsWhether the CRLs should be included in the signature's KeyInfo. Default value:false -
includeX509IssuerSerial
private boolean includeX509IssuerSerialWhether the end-entity certificate's issuer and serial number should be included in the signature's KeyInfo. Default value:false -
debugPreDigest
private boolean debugPreDigestWhether to debug digest operations by logging the pre-digest data stream. Default value:false
-
-
Constructor Details
-
XMLSignatureSigningStage
public XMLSignatureSigningStage()
-
-
Method Details
-
getSHAVariant
Gets the SHA algorithm variant used when computing the signature and digest.- Returns:
- SHA algorithm variant used when computing the signature and digest
- Since:
- 0.10.0
-
setSHAVariant
Sets the SHA algorithm variant used when computing the signature and digest.- Parameters:
variant- SHA algorithm variant used when computing the signature and digest- Since:
- 0.10.0
-
getShaVariant
@Deprecated(forRemoval=true) @Nonnull public final XMLSignatureSigningStage.SHAVariant getShaVariant()Deprecated, for removal: This API element is subject to removal in a future version.UsegetSHAVariant().Gets the SHA algorithm variant used when computing the signature and digest.- Returns:
- SHA algorithm variant used when computing the signature and digest
-
setShaVariant
@Deprecated(forRemoval=true) public void setShaVariant(@Nonnull XMLSignatureSigningStage.SHAVariant variant) Deprecated, for removal: This API element is subject to removal in a future version.Sets the SHA algorithm variant used when computing the signature and digest.- Parameters:
variant- SHA algorithm variant used when computing the signature and digest
-
getPrivateKey
Gets the private key used to sign the content.- Returns:
- the privKey private key used to sign the content
-
setPrivateKey
Sets the private key used to sign the content.- Parameters:
key- private key used to sign the content
-
getPublicKey
Gets the public key associated with private key used to sign the content.- Returns:
- public key associated with private key used to sign the content
-
setPublicKey
Sets public key associated with private key used to sign the content.- Parameters:
key- public key associated with private key used to sign the content
-
getCertificates
Gets the certificates associated with the key used to sign the content. The end-entity certificate is the first element in the list.- Returns:
- certificates associated with the key used to sign the content
-
setCertificates
Sets the certificates associated with the key used to sign the content. The end-entity certificate must be the first element in the list.- Parameters:
certs- certificates associated with the key used to sign the content
-
getCrls
Gets the CRLs associated with certificates.- Returns:
- CRLs associated with certificates
-
setCrls
Sets the CRLs associated with certificates.- Parameters:
revocationLists- CRLs associated with certificates
-
isC14nExclusive
public final boolean isC14nExclusive()Gets whether exclusive canonicalization will be used.- Returns:
- whether exclusive canonicalization will be used
-
setC14nExclusive
public void setC14nExclusive(boolean isExclusive) Sets whether exclusive canonicalization will be used.- Parameters:
isExclusive- whether exclusive canonicalization will be used
-
isC14nWithComments
public final boolean isC14nWithComments()Gets whether comments are canonicalized.- Returns:
- whether comments are canonicalized
-
setC14nWithComments
public void setC14nWithComments(boolean withComments) Sets whether comments are canonicalized.- Parameters:
withComments- whether comments are canonicalized
-
getInclusivePrefixList
Gets the inclusive prefix list used during exclusive canonicalization.- Returns:
- inclusive prefix list used during exclusive canonicalization
-
setInclusivePrefixList
Sets the inclusive prefix list used during exclusive canonicalization.- Parameters:
prefixList- inclusive prefix list used during exclusive canonicalization
-
getIdAttributeNames
Gets the names of the attributes treated as reference IDs.- Returns:
- names of the attributes treated as reference IDs
-
setIdAttributeNames
Sets the names of the attributes treated as reference IDs.- Parameters:
names- names of the attributes treated as reference IDs
-
getKeyNames
Gets the explicit key names added to the KeyInfo.- Returns:
- explicit key names added to the KeyInfo
-
setKeyNames
Sets the explicit key names added to the KeyInfo.- Parameters:
names- explicit key names added to the KeyInfo
-
isIncludeKeyNames
public final boolean isIncludeKeyNames()Gets whether key names are included in the KeyInfo.- Returns:
- whether key names are included in the KeyInfo
-
setIncludeKeyNames
public void setIncludeKeyNames(boolean include) Sets whether key names are included in the KeyInfo.- Parameters:
include- whether key names are included in the KeyInfo
-
isIncludeKeyValue
public final boolean isIncludeKeyValue()Gets whether key values are included in the KeyInfo.- Returns:
- whether key values are included in the KeyInfo
-
setIncludeKeyValue
public void setIncludeKeyValue(boolean included) Sets whether key values are included in the KeyInfo.- Parameters:
included- whether key values are included in the KeyInfo
-
isIncludeX509SubjectName
public final boolean isIncludeX509SubjectName()Gets whether end-entity certifcate's subject name is included in the KeyInfo.- Returns:
- whether end-entity certifcate's subject name is included in the KeyInfo
-
setIncludeX509SubjectName
public void setIncludeX509SubjectName(boolean include) Sets whether end-entity certifcate's subject name is included in the KeyInfo.- Parameters:
include- whether end-entity certifcate's subject name is included in the KeyInfo
-
isIncludeX509Certificates
public final boolean isIncludeX509Certificates()Gets whether X509 certificates are included in the KeyInfo.- Returns:
- whether X509 certificates are included in the KeyInfo
-
setIncludeX509Certificates
public void setIncludeX509Certificates(boolean include) Sets whether X509 certificates are included in the KeyInfo.- Parameters:
include- whether X509 certificates are included in the KeyInfo
-
isIncludeX509Crls
public final boolean isIncludeX509Crls()Gets whether CRLs are included in the KeyInfo.- Returns:
- whether CRLs are included in the KeyInfo
-
setIncludeX509Crls
public void setIncludeX509Crls(boolean include) Sets whether CRLs are included in the KeyInfo.- Parameters:
include- whether CRLs are included in the KeyInfo
-
isIncludeX509IssuerSerial
public final boolean isIncludeX509IssuerSerial()Gets whether the end-entity certificate's issuer and serial number are included in the KeyInfo.- Returns:
- whether the end-entity certificate's issuer and serial number are included in the KeyInfo
-
setIncludeX509IssuerSerial
public void setIncludeX509IssuerSerial(boolean include) Sets whether the end-entity certificate's issuer and serial number are included in the KeyInfo.- Parameters:
include- whether the end-entity certificate's issuer and serial number are included in the KeyInfo
-
isDebugPreDigest
public final boolean isDebugPreDigest()Gets whether logging of the pre-digest data stream is enabled.- Returns:
- whether logging of the pre-digest data stream is enabled
-
setDebugPreDigest
public void setDebugPreDigest(boolean debug) Sets whether logging of the pre-digest data stream is enabled.- Parameters:
debug- whether logging of the pre-digest data stream is enabled
-
isRemovingCRsFromSignature
public final boolean isRemovingCRsFromSignature()Gets whether CR characters will be removed from generated signatures.- Returns:
trueif CR characters will be removed from generated signatures.
-
setRemovingCRsFromSignature
public final void setRemovingCRsFromSignature(boolean newValue) Sets whether to remove CR characters from generated signatures.- Parameters:
newValue- whether to remove CR characters from generated signatures.
-
doExecute
protected void doExecute(@Nonnull @NonnullElements List<Item<Element>> items) throws StageProcessingException Description copied from class:AbstractStagePerforms the stage processing on the given Item collection.The stage is guaranteed to be have been initialized and not destroyed when this is invoked.
- Specified by:
doExecutein classAbstractStage<Element>- Parameters:
items- collection to be processed- Throws:
StageProcessingException- thrown if there is an unrecoverable problem when processing the stage
-
doInitialize
protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException- Overrides:
doInitializein classnet.shibboleth.shared.component.AbstractIdentifiedInitializableComponent- Throws:
net.shibboleth.shared.component.ComponentInitializationException
-
getSHAVariant().