public interface Signable extends Closeable
| Modifier and Type | Method and Description |
|---|---|
default byte[] |
computeDigest(net.jsign.DigestAlgorithm digestAlgorithm)
Computes the digest of the file.
|
org.bouncycastle.asn1.ASN1Object |
createIndirectData(net.jsign.DigestAlgorithm digestAlgorithm)
Creates the SpcIndirectDataContent structure containing the digest of the file.
|
default List<org.bouncycastle.asn1.cms.Attribute> |
createSignedAttributes(X509Certificate certificate)
Creates the signed attributes to include in the signature.
|
default org.bouncycastle.cms.CMSTypedData |
createSignedContent(net.jsign.DigestAlgorithm digestAlgorithm)
Creates the ContentInfo or EncapsulatedContentInfo structure to be signed.
|
List<org.bouncycastle.cms.CMSSignedData> |
getSignatures()
Returns the Authenticode signatures on the file.
|
static Signable |
of(File file)
Returns a signable object for the file specified.
|
static Signable |
of(File file,
Charset encoding)
Returns a signable object for the file specified.
|
void |
save()
Saves the file.
|
void |
setSignature(org.bouncycastle.cms.CMSSignedData signature)
Sets the signature of the file, overwriting the previous one.
|
default void |
setSignatures(List<org.bouncycastle.cms.CMSSignedData> signatures)
Sets the signatures of the file, overwriting the previous ones.
|
default void |
validate(Certificate certificate)
Checks if the specified certificate is suitable for signing the file.
|
default byte[] computeDigest(net.jsign.DigestAlgorithm digestAlgorithm) throws IOException
digestAlgorithm - the digest algorithm to useIOException - if an I/O error occursorg.bouncycastle.asn1.ASN1Object createIndirectData(net.jsign.DigestAlgorithm digestAlgorithm) throws IOException
digestAlgorithm - the digest algorithm to useIOException - if an I/O error occursdefault List<org.bouncycastle.asn1.cms.Attribute> createSignedAttributes(X509Certificate certificate) throws CertificateEncodingException
certificate - the signing certificateCertificateEncodingExceptiondefault org.bouncycastle.cms.CMSTypedData createSignedContent(net.jsign.DigestAlgorithm digestAlgorithm) throws IOException
digestAlgorithm - the digest algorithm to useIOException - if an I/O error occursList<org.bouncycastle.cms.CMSSignedData> getSignatures() throws IOException
setSignatures(List).IOException - if an I/O error occursstatic Signable of(File file) throws IOException
file - the file that is intended to be signedIOException - if an I/O error occursUnsupportedOperationException - if the file specified isn't supportedstatic Signable of(File file, Charset encoding) throws IOException
file - the file that is intended to be signedencoding - the character encoding (for text files only).
If the file has a byte order mark this parameter is ignored.IOException - if an I/O error occursUnsupportedOperationException - if the file specified isn't supportedvoid save() throws IOException
IOException - if an I/O error occursvoid setSignature(org.bouncycastle.cms.CMSSignedData signature) throws IOException
signature - the signature to put, or null to remove the signatureIOException - if an I/O error occursdefault void setSignatures(List<org.bouncycastle.cms.CMSSignedData> signatures) throws IOException
setSignature(CMSSignedData).signatures - the signatures to put, empty or null to remove the signaturesIOException - if an I/O error occursdefault void validate(Certificate certificate) throws IOException, IllegalArgumentException
certificate - the certificate to validateIOException - if an I/O error occursIllegalArgumentException - if the certificate doesn't match the publisher identityCopyright © 2012–2025. All rights reserved.