Package net.visma.autopay.http.signature
Class SignatureSpec.Builder
java.lang.Object
net.visma.autopay.http.signature.SignatureSpec.Builder
- Enclosing class:
- SignatureSpec
Builder class to build
SignatureSpec
objects.
Private key must be provided as either PrivateKey
object, or PKCS#8-encoded byte[] or PKCS#8-Base64-encoded String.
Signature parameters must be provided, and they must contain the signature algorithm.
Signature label must be provided.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
ConstructsSignatureSpec
object from this buildercomponents
(SignatureComponents components) Sets required Signature Componentscontext
(SignatureContext signatureContext) Sets Signature Contextparameters
(SignatureParameters parameters) Sets Signature ParametersprivateKey
(byte[] privateKey) Sets private key, encoded as bytes[] in PKCS#8 formatprivateKey
(String privateKey) Sets private key, provided as PKCS#8-base-64-encoded StringprivateKey
(PrivateKey privateKey) Sets private key used to create the signaturesignatureLabel
(String signatureLabel) Sets signature labelusedIfPresentComponents
(SignatureComponents components) Sets Signature Components included in the signature only if related values are present in the Signature Context.
-
Method Details
-
parameters
Sets Signature Parameters- Parameters:
parameters
- Signature Parameters used to create signature- Returns:
- This builder
-
components
Sets required Signature ComponentsIf related values are not provided in the Signature Context, e.g. missing HTTP header value, an exception will be thrown when computing the signature.
- Parameters:
components
- Required Signature Components- Returns:
- This builder
-
usedIfPresentComponents
Sets Signature Components included in the signature only if related values are present in the Signature Context.usedIfPresentComponents are added to Signature-Input after required components
- Parameters:
components
- Signature Components used uif present in the Signature Context- Returns:
- This builder
-
context
Sets Signature Context- Parameters:
signatureContext
- Signature Context with values obtained from signed request or response- Returns:
- This builder
-
privateKey
Sets private key used to create the signature- Parameters:
privateKey
- PrivateKey object- Returns:
- This builder
-
privateKey
Sets private key, encoded as bytes[] in PKCS#8 format- Parameters:
privateKey
- PKCS#8-encoded private key- Returns:
- This builder
-
privateKey
Sets private key, provided as PKCS#8-base-64-encoded StringIt can contain multiple lines, including BEGIN PRIVATE KEY and END PRIVATE KEY.
- Parameters:
privateKey
- PKCS#8-base-64-encoded private key- Returns:
- This builder
-
signatureLabel
Sets signature label- Parameters:
signatureLabel
- Signature label- Returns:
- This builder
- See Also:
-
build
ConstructsSignatureSpec
object from this builderAll required data mentioned in
SignatureSpec.Builder
must be provided (private key, signature algorithm, signature label).- Returns:
- SignatureSpec object
-