Package com.altova.raptorxml
Interface XMLDsig
- All Known Implementing Classes:
HTTPXMLDsig
public interface XMLDsig
-
Method Summary
Modifier and TypeMethodDescriptionboolean
executeRemove
(String strResultOutputFileName) Execute the remove command.boolean
executeSign
(String strResultOutputFileName, String strSignatureType, String strSignatureCanonicalizationMethod) Execute the sign command.boolean
executeUpdate
(String strResultOutputFileName) Execute the update command.boolean
Execute the verify command.Get the last error message from the engine.void
setAbsoluteReferenceUri
(boolean boAbsolute) Specifies whether the URI of the signed document is to be read as absolute (true) or relative (false).void
setAppendKeyInfo
(boolean boAppend) Append KeyInfo element to signature.void
setCertificateName
(String strCertName) The name of the certificate used for signing.void
setCertificateStore
(String strCertStore) Certificate store that contains the certificate used for signing.void
setDigestMethod
(String strDigestMethod) DigestMethod Algorithm used to compute the digest value over the input.void
setHMACOutputLength
(int length) Truncate the output of the HMAC algorithm to length.void
setHMACSecretKey
(String strSecretKey) Set the HMAC shared secret key; must have a minimum length of six characters.void
setInputFileName
(String filePath) Set the file name for the input XML data.void
setSignatureMethod
(String strSignatureMethod) Set the signature-method; Specifies the algorithm to use for generating the signatur.void
setTransforms
(String strTransforms) XML Signature transformations applied to the input.void
setWriteDefaultAttributes
(boolean boDefaultAttributes) Include attribute values defaulted from DTD in signed document.
-
Method Details
-
executeSign
boolean executeSign(String strResultOutputFileName, String strSignatureType, String strSignatureCanonicalizationMethod) throws RaptorXMLException Execute the sign command. It takes an XML document as input and creates an XML signature output document using the specified signing options. In case of an error, use functiongetLastErrorMessage()
to get additional information.- Parameters:
strResultOutputFileName
- Location of the result output filestrSignatureType
- Specifies the type of signature to be generated. (Examples: detached, enveloping, enveloped)strSignatureCanonicalizationMethod
- Specifies the canonicalization algorithm applied to the SignedInfo element. (Examples: xml-c14n11, REC-xml-c14n - 20010315, ...)- Returns:
- true on success, false on failure. In case of an error, use function
getLastErrorMessage()
to get additional information. - Throws:
RaptorXMLException
-
executeVerify
Execute the verify command. It verifies the XML signature of the input file. In case of an error, use functiongetLastErrorMessage()
to get additional information.- Returns:
- true on success, false on failure. In case of an error, use function
getLastErrorMessage()
to get additional information. - Throws:
RaptorXMLException
-
executeUpdate
Execute the update command. It updates the XML signature in the signed input file. If the document has been modified, the XML signature will be different; otherwise, the updated signature will be the same as the previous signature. In case of an error, use functiongetLastErrorMessage()
to get additional information.- Parameters:
strResultOutputFileName
- Location of the result output file- Returns:
- true on success, false on failure. In case of an error, use function
getLastErrorMessage()
to get additional information. - Throws:
RaptorXMLException
-
executeRemove
Execute the remove command. It removes the XML signature of the signed input file, and saves the resulting unsigned document to an output location that you specify. In case of an error, use functiongetLastErrorMessage()
to get additional information.- Parameters:
bstrResultOutputFileName
- Location of the result output file- Returns:
- true on success, false on failure. In case of an error, use function
getLastErrorMessage()
to get additional information. - Throws:
RaptorXMLException
-
setInputFileName
Set the file name for the input XML data. Please note that you have to use absolute URLs.- Parameters:
filePath
- an absolute URL giving the base location of the XML data.
-
setHMACSecretKey
Set the HMAC shared secret key; must have a minimum length of six characters.- Parameters:
strSecretKey
- the HMAC shared secret key string.
-
setSignatureMethod
Set the signature-method; Specifies the algorithm to use for generating the signatur. If a certificate is specified, than signature-method is optional and the value for this parameter is derived from the certificate. When specified, it must match the algorithm used by the certificate. Example: rsa-sha256 When hmac-secret-key is used, then this option is mandatory. The value must be one of the supported HMAC algorithms: hmac-sha256, hmac-sha386, hmac-sha512, hmac-sha1 (discoureged by the specification)- Parameters:
strSecretKey
- the HMAC shared secret key string.
-
setAbsoluteReferenceUri
void setAbsoluteReferenceUri(boolean boAbsolute) Specifies whether the URI of the signed document is to be read as absolute (true) or relative (false). Default is false.- Parameters:
New
- value of absolute-reference-uri
-
setCertificateName
The name of the certificate used for signing. Can't be used with --hmac-secret-key. [Windows: name of certificate in certificate-store, linux / macos: name of .PEM certificate file with private key.]- Parameters:
strCertName
- the certname string
-
setCertificateStore
Certificate store that contains the certificate used for signing. [Windows only, mandatory when certificate-name is specified.]- Parameters:
strCertStore
- the certstore string
-
setDigestMethod
DigestMethod Algorithm used to compute the digest value over the input. [default: sha256]- Parameters:
strCertName
- the certname string
-
setHMACOutputLength
void setHMACOutputLength(int length) Truncate the output of the HMAC algorithm to length. (multiple of 8, only in conjunction with --hmac-secret-key.)- Parameters:
New
- length
-
setAppendKeyInfo
void setAppendKeyInfo(boolean boAppend) Append KeyInfo element to signature. [default: false]- Parameters:
New
- bool value of AppendKeyInfo
-
setTransforms
XML Signature transformations applied to the input. (Examples: xml-c14n11, base64, strip-whitespaces)- Parameters:
New
- transforms string
-
setWriteDefaultAttributes
void setWriteDefaultAttributes(boolean boDefaultAttributes) Include attribute values defaulted from DTD in signed document. [default: false]- Parameters:
New
- bool value of defaultAttributes
-
getLastErrorMessage
String getLastErrorMessage()Get the last error message from the engine.- Returns:
- last error message
-