@License public class SigningStreamConfigurator extends Object
| Modifier and Type | Field and Description |
|---|---|
protected SignatureAlgorithm |
algorithm
The digest and encryption algorithm combination used to create the signature.
|
protected String |
alias
The alias identifying the certificate to be used for signing.
|
static boolean |
DEFAULT_ENCAPSULATE_DATA
Whether by default data should be encapsulated along with the signature.
|
static boolean |
DEFAULT_VERIFY_CERTIFICATE
Whether by default the signing certificate must be verified.
|
protected boolean |
encapsulateData
Whether the signer should encapsulate data along with the signature.
|
protected KeyRing |
keyring
The key ring (as a wrapper and helper to access the key store).
|
protected Provider |
provider
The security provider.
|
protected List<X509Certificate> |
trustAnchors
A collection of certificates to be used as trust anchors in PKIX certification
path buildup and verification.
|
protected boolean |
verifyCertificate
Whether the signer should verify the certificate before signing.
|
| Constructor and Description |
|---|
SigningStreamConfigurator()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
SigningStreamConfigurator |
addTrustAnchor(Certificate trustAnchor)
Adds the given trust anchor certificate to the set that will be used for
PKIX certificate verification path buildup.
|
SigningStreamConfigurator |
addTrustAnchors(Collection<X509Certificate> trustAnchors)
Adds the given collection of trust anchor certificates to the set that will
be used for PKIX certificate verification path buildup.
|
SigningStreamConfigurator |
clearTrustAnchors()
Resets the collection of trust anchor certificates to be used for PKIX
certificate verification path buildup.
|
SignatureAlgorithm |
getAlgorithm()
Returns the value of the algorithm.
|
String |
getAlias()
Returns the value of the alias.
|
X509Certificate |
getCertificate()
Retrieves the signing certificate, possibly checking it against the list
of trust anchor certificates (if provided).
|
KeyRing |
getKeyRing()
Returns the value of the key ring.
|
Key |
getPrivateKey()
Returns the private key corresponding to the given alias.
|
Provider |
getProvider()
Returns the value of the provider.
|
Collection<X509Certificate> |
getTrustAnchors()
Returns the collection of trust anchor certificates.
|
boolean |
isEncapsulateData()
Returns whether the signer should encapsulate data along with the signature.
|
boolean |
isVerifyCertificate()
Returns whether the signer should verify the certificate before signing.
|
SigningStreamConfigurator |
setAlgorithm(SignatureAlgorithm algorithm)
Sets the new value of the algorithm.
|
SigningStreamConfigurator |
setAlias(String alias)
Sets the new value of the signing certificate alias.
|
SigningStreamConfigurator |
setEncapsulateData(boolean encapsulateData)
Sets whether the signer should encapsulate data along with the signature.
|
SigningStreamConfigurator |
setKeyRing(KeyRing keyring)
Sets the new value of the key ring.
|
SigningStreamConfigurator |
setProvider(Provider provider)
Sets the new value of the provider.
|
SigningStreamConfigurator |
setVerifyCertificate(boolean verifyCertificate)
Sets whether the signer should verify the certificate before signing.
|
String |
toString() |
public static final boolean DEFAULT_ENCAPSULATE_DATA
public static final boolean DEFAULT_VERIFY_CERTIFICATE
protected SignatureAlgorithm algorithm
protected String alias
protected KeyRing keyring
protected Provider provider
protected List<X509Certificate> trustAnchors
protected boolean encapsulateData
protected boolean verifyCertificate
public SigningStreamConfigurator()
public SignatureAlgorithm getAlgorithm()
public SigningStreamConfigurator setAlgorithm(SignatureAlgorithm algorithm)
algorithm - the algorithm to set.public String getAlias()
public SigningStreamConfigurator setAlias(String alias)
alias - the alias to set.public KeyRing getKeyRing()
public SigningStreamConfigurator setKeyRing(KeyRing keyring)
keyring - the key ring to set.public Provider getProvider()
public SigningStreamConfigurator setProvider(Provider provider)
provider - the provider to set.public boolean isEncapsulateData()
public SigningStreamConfigurator setEncapsulateData(boolean encapsulateData)
encapsulateData - whether the signer should encapsulate data along with the signature.public boolean isVerifyCertificate()
public SigningStreamConfigurator setVerifyCertificate(boolean verifyCertificate)
verifyCertificate - whether the signer should verify the certificate before signing.public Collection<X509Certificate> getTrustAnchors()
public SigningStreamConfigurator addTrustAnchor(Certificate trustAnchor)
trustAnchor - the trust anchor certificate to add.public SigningStreamConfigurator addTrustAnchors(Collection<X509Certificate> trustAnchors)
trustAnchors - the collection of trust anchor certificates to add.public SigningStreamConfigurator clearTrustAnchors()
public String toString()
toString in class ObjectObject.toString()public Key getPrivateKey() throws CryptoException
CryptoExceptionpublic X509Certificate getCertificate() throws CryptoException, KeyStoreException, GeneralSecurityException, CertificateExpiredException, CertificateNotYetValidException
trustAnchors - an optional list of trust anchor certificate collections.CryptoExceptionKeyStoreExceptionCertificateExpiredExceptionCertificateNotYetValidExceptionGeneralSecurityExceptionCopyright © 2012-2014 Andrea Funtò. See here for terms and conditions.