Package org.apache.wss4j.dom.message
Class WSSecDKSign
java.lang.Object
org.apache.wss4j.dom.message.WSSecBase
org.apache.wss4j.dom.message.WSSecSignatureBase
org.apache.wss4j.dom.message.WSSecDerivedKeyBase
org.apache.wss4j.dom.message.WSSecDKSign
Builder to sign with derived keys
-
Field Summary
Fields inherited from class org.apache.wss4j.dom.message.WSSecBase
addWSUNamespace, attachmentCallbackHandler, callbackLookup, expandXopInclude, keyIdentifierType, password, storeBytesInAttachment, user -
Constructor Summary
ConstructorsConstructorDescriptionWSSecDKSign(WSSecHeader securityHeader) WSSecDKSign(Document doc) WSSecDKSign(Document doc, Provider provider) -
Method Summary
Modifier and TypeMethodDescriptionaddReferencesToSign(List<WSEncryptionPart> references) This method adds references to the Signature.build(byte[] ephemeralKey) voidcomputeSignature(List<Reference> referenceList) Compute the Signature over the references.voidcomputeSignature(List<Reference> referenceList, boolean prepend, Element siblingElement) Compute the Signature over the references.protected intThe derived key will change depending on the sig/encr algorithm.Get the canonicalization method.Returns the SignatureElement.Returns the the value of wsu:Id attribute of the Signature element.byte[]booleanvoidprepare(byte[] ephemeralKey) Initialize a WSSec Derived key.voidsetAddInclusivePrefixes(boolean addInclusivePrefixes) voidsetDerivedKeyLength(int keyLength) voidsetDigestAlgorithm(String algorithm) Set the digest algorithm to use.voidsetSigCanonicalization(String algo) Set the canonicalization method to use.voidsetSignatureAlgorithm(String algorithm) Set the signature algorithm to use.Methods inherited from class org.apache.wss4j.dom.message.WSSecDerivedKeyBase
appendDKElementToHeader, clean, getDerivedKey, getdktElement, getId, getStrElem, getTokenIdentifier, getWscVersion, prependDKElementToHeader, setClientLabel, setCrypto, setCustomValueType, setServiceLabel, setStrElem, setTokenIdDirectId, setTokenIdentifier, setWscVersion, setX509CertificateMethods inherited from class org.apache.wss4j.dom.message.WSSecSignatureBase
addReferencesToSign, cleanup, createSTRParameter, getInclusivePrefixes, getInclusivePrefixesMethods inherited from class org.apache.wss4j.dom.message.WSSecBase
getDocument, getIdAllocator, getKeyIdentifierType, getParts, getSecurityHeader, getWsDocInfo, isExpandXopInclude, setAttachmentCallbackHandler, setBodyID, setCallbackLookup, setExpandXopInclude, setIdAllocator, setKeyIdentifierType, setStoreBytesInAttachment, setUserInfo, setWsDocInfo, setWsuId
-
Constructor Details
-
WSSecDKSign
-
WSSecDKSign
-
WSSecDKSign
-
-
Method Details
-
build
- Throws:
WSSecurityException
-
prepare
Description copied from class:WSSecDerivedKeyBaseInitialize a WSSec Derived key. The method prepares and initializes a WSSec derived key structure after the relevant information was set. This method also creates and initializes the derived token using the ephemeral key. After preparation references can be added, encrypted and signed as required. This method does not add any element to the security header. This must be done explicitly.- Overrides:
preparein classWSSecDerivedKeyBase- Parameters:
ephemeralKey- The ephemeral key to use for derivation- Throws:
WSSecurityException
-
getSignatureElement
Returns the SignatureElement. The method can be called any time afterprepare().- Returns:
- The DOM Element of the signature.
-
addReferencesToSign
public List<Reference> addReferencesToSign(List<WSEncryptionPart> references) throws WSSecurityException This method adds references to the Signature.- Parameters:
references- The list of references to sign- Throws:
WSSecurityException
-
computeSignature
Compute the Signature over the references. After references are set this method computes the Signature for them. This method can be called any time after the references were set. SeeaddReferencesToSign().- Throws:
WSSecurityException
-
computeSignature
public void computeSignature(List<Reference> referenceList, boolean prepend, Element siblingElement) throws WSSecurityException Compute the Signature over the references. After references are set this method computes the Signature for them. This method can be called any time after the references were set. SeeaddReferencesToSign().- Throws:
WSSecurityException
-
getDerivedKeyLength
Description copied from class:WSSecDerivedKeyBaseThe derived key will change depending on the sig/encr algorithm. Therefore the child classes are expected to provide this value.- Specified by:
getDerivedKeyLengthin classWSSecDerivedKeyBase- Returns:
- the derived key length
- Throws:
WSSecurityException
-
setDerivedKeyLength
public void setDerivedKeyLength(int keyLength) -
setSignatureAlgorithm
Set the signature algorithm to use. The default is WSConstants.SHA1.- Parameters:
algorithm- the signature algorithm to use.
-
getSignatureAlgorithm
- Returns:
- the signature algorithm to use
-
getSignatureId
Returns the the value of wsu:Id attribute of the Signature element.- Returns:
- Return the wsu:Id of this token or null if the signature has not been generated.
-
setDigestAlgorithm
Set the digest algorithm to use. The default is WSConstants.SHA1.- Parameters:
algorithm- the digest algorithm to use.
-
getDigestAlgorithm
- Returns:
- the digest algorithm to use
-
getSignatureValue
public byte[] getSignatureValue()- Returns:
- Returns the signatureValue.
-
setSigCanonicalization
Set the canonicalization method to use. If the canonicalization method is not set then the recommended Exclusive XML Canonicalization is used by default Refer to WSConstants which algorithms are supported.- Parameters:
algo- Is the name of the signature algorithm- See Also:
-
getSigCanonicalization
Get the canonicalization method. If the canonicalization method was not set then Exclusive XML Canonicalization is used by default.- Returns:
- The string describing the canonicalization algorithm.
-
isAddInclusivePrefixes
public boolean isAddInclusivePrefixes() -
setAddInclusivePrefixes
public void setAddInclusivePrefixes(boolean addInclusivePrefixes)
-