Constructor and Description |
---|
KSIBuilder() |
Modifier and Type | Method and Description |
---|---|
KSI |
build()
Builds the
KSI instance. |
KSIBuilder |
setDefaultSigningHashAlgorithm(HashAlgorithm defaultHashAlgorithm)
Sets the default signing algorithm to be used to create new KSI signatures.
|
KSIBuilder |
setDefaultVerificationPolicy(Policy defaultVerificationPolicy)
Sets a default verification policy.
|
KSIBuilder |
setKsiProtocolExtenderClient(KSIExtenderClient extenderClient)
Sets the extender client to be used in verification and extending process.
|
KSIBuilder |
setKsiProtocolExtendingService(KSIExtendingService extendingService)
Sets the extending service to be used in extending process.
|
KSIBuilder |
setKsiProtocolPublicationsFileClient(KSIPublicationsFileClient publicationsFileClient)
Sets the publications file client to be used to download publications file.
|
KSIBuilder |
setKsiProtocolSignerClient(KSISigningClient signingClient)
Sets the signer client to be used in signing process.
|
KSIBuilder |
setKsiProtocolSigningService(KSISigningService signingService)
Sets the signing service to be used in signing process.
|
KSIBuilder |
setPduIdentifierProvider(PduIdentifierProvider pduIdentifierProvider)
Deprecated.
|
KSIBuilder |
setPublicationsFileCacheExpirationTime(long expirationTime)
Sets the publications file expiration time.
|
KSIBuilder |
setPublicationsFilePkiTrustStore(File file,
String password)
|
KSIBuilder |
setPublicationsFilePkiTrustStore(KeyStore trustStore)
Sets the
KeyStore to be used as truststore to verify the certificate that was used to sign the
publications file. |
KSIBuilder |
setPublicationsFileTrustedCertSelector(CertSelector certSelector)
Sets the
CertSelector to be used to verify the certificate that was used to sign
the publications file. |
public KSIBuilder setDefaultSigningHashAlgorithm(HashAlgorithm defaultHashAlgorithm)
Signer.sign(DataHash)
method, this algorithm is ignored. Default value is HashAlgorithm.SHA2_256
defaultHashAlgorithm
- the hash algorithm to be used to create new KSI signatures.KSIBuilder
.public KSIBuilder setKsiProtocolSigningService(KSISigningService signingService)
signingService
- instance of KSISigningService
.KSIBuilder
.public KSIBuilder setKsiProtocolExtendingService(KSIExtendingService extendingService)
extendingService
- instance of KSIExtendingService
.KSIBuilder
.public KSIBuilder setKsiProtocolSignerClient(KSISigningClient signingClient)
signingClient
- instance of KSISigningClient
.KSIBuilder
.public KSIBuilder setKsiProtocolExtenderClient(KSIExtenderClient extenderClient)
extenderClient
- instance of KSIExtenderClient
.KSIBuilder
.public KSIBuilder setKsiProtocolPublicationsFileClient(KSIPublicationsFileClient publicationsFileClient)
publicationsFileClient
- instance of KSIPublicationsFileClient
.KSIBuilder
.public KSIBuilder setPublicationsFilePkiTrustStore(KeyStore trustStore) throws KSIException
KeyStore
to be used as truststore to verify the certificate that was used to sign the
publications file. If not set, the default Java keystore is used.trustStore
- truststore to be used to verify certificates.KSIBuilder
.KSIException
- when any error occurs.public KSIBuilder setPublicationsFilePkiTrustStore(File file, String password) throws KSIException
KeyStore
from the file system and sets the KeyStore
to be used as a truststore to verify
the certificate that was used to sign the publications file.file
- keystore file on disk, not null.password
- password of the keystore, null if keystore isn't protected by password.KSIBuilder
.KSIException
- when any error occurs.public KSIBuilder setPublicationsFileTrustedCertSelector(CertSelector certSelector)
CertSelector
to be used to verify the certificate that was used to sign
the publications file. X509CertSelector
can be used instead of X509CertificateSubjectRdnSelector
certSelector
- instance of CertSelector
.KSIBuilder
.X509CertSelector
public KSIBuilder setPublicationsFileCacheExpirationTime(long expirationTime)
@Deprecated public KSIBuilder setPduIdentifierProvider(PduIdentifierProvider pduIdentifierProvider)
public KSIBuilder setDefaultVerificationPolicy(Policy defaultVerificationPolicy)
InvalidSignatureContentException
exception is thrown.
If needed, user can access the invalid signature and verification result using the methods
InvalidSignatureContentException.getSignature()
and
InvalidSignatureContentException.getVerificationResult()
.
The following values are used to build a verification context that will be used by default verification policy:
VerificationContextBuilder.setExtendingAllowed(boolean)
is set to true.VerificationContextBuilder.setExtenderClient(KSIExtenderClient)
- an extender client configured by
KSIBuilder
class is used.VerificationContextBuilder.setPublicationsFile(PublicationsFile)
- a publication file configured
by KSIBuilder
class is used.VerificationContextBuilder.setDocumentHash(DataHash)
- input hash is used only in case of signature creation, otherwise null value is used.VerificationContextBuilder.setUserPublication(PublicationData)
- null value is always used.VerificationContextBuilder.setSignature(KSISignature)
- the signature to be returned to the user.PublicationData
can not
be used as default verification policy by API users because user publication is always null.
By default InternalVerificationPolicy
is used.public KSI build() throws KSIException
KSI
instance. Checks that the signing, extender and publications file clients are set.KSI
class.KSIException
- will be thrown when some client is null.Copyright © 2024 Guardtime. All rights reserved.