public class CAdESSigner extends Object implements PKCS7Signer
| Constructor and Description |
|---|
CAdESSigner() |
CAdESSigner(String algorithm,
PolicyFactory.Policies police) |
CAdESSigner(String algorithm,
PolicyFactory.Policies police,
boolean pades) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
doAttachedSign(byte[] content)
Generates a digital signature from a content and attaches this content on result file
|
byte[] |
doAttachedSign(byte[] content,
byte[] previewSigned)
Generates a digital co-signature from a content and attaches this content on result file
|
byte[] |
doCounterSign(byte[] previewCMSSignature)
Generates a digital couter-signature
|
byte[] |
doDetachedSign(byte[] content)
Generates a digital signature from a content,
the result does not contains the content that was signed
|
byte[] |
doDetachedSign(byte[] content,
byte[] previewSigned)
Generates a digital co-signature from a content,
the result file does not contains the content that was signed
|
byte[] |
doHashCoSign(byte[] hash,
byte[] previewSigned)
Generates a digital co-signature from a previous calculated hash for a content,
and its previous signatures
the result file does not contains the original content that was signed
|
byte[] |
doHashSign(byte[] hash)
Generates a digital signature from a previous calculated hash for a content,
the result file does not contains the original content that was signed
|
byte[] |
envelopAttachedSign(org.bouncycastle.cms.CMSSignedData signedData)
Generates a digital signature from a content and attaches this content on result
On this step only signed attributes are generates
|
byte[] |
envelopDetachedSign(org.bouncycastle.cms.CMSSignedData signedData)
Generates a digital signature from a content,
the result does not contains the content that was signed
On this step only signed attributes are generates
|
byte[] |
envelopHashSign(org.bouncycastle.cms.CMSSignedData signedData)
Generates a digital signature from a previous calculated hash for a content,
the result does not contains the original content that was signed
On this step only signed attributes are generates
|
byte[] |
envelopSignature(org.bouncycastle.cms.CMSSignedData cmsSignedData,
byte[] previewSignature) |
Certificate[] |
extractCertificates(byte[] previewSignature)
Extrai a lista de certificados incluídos em um envelope PKCS#7 ou CMS
|
org.bouncycastle.util.Store<?> |
generatedCertStore(Certificate[] previewCerts) |
String |
getAlgorithm()
Returns the algorithm to be used in the signature
|
CertificateManager |
getCertificateManager() |
byte[] |
getHash() |
Date |
getNotAfterSignerCertificate()
Data of end of Certificate use.
|
String |
getPolicyName() |
PrivateKey |
getPrivateKey()
Returns the private key.
|
PrivateKey |
getPrivateKeyForTimeStamp() |
Provider |
getProvider()
Returns the provider.
|
PublicKey |
getPublicKey()
Returns the public key.
|
String |
getSignatory() |
boolean |
isAttached() |
boolean |
isDefaultCertificateValidators() |
boolean |
isPades() |
AlgAndLength |
prepareAlgAndLength()
Seleciona os algorítmos de hash e criptografia e também o tamanho mínimo da
chave que será utilizada para realizar a assinatura.
|
org.bouncycastle.cms.CMSSignedData |
prepareAttachedSign(byte[] content)
Prepare to Generates a digital signature from a content and attaches this content on result
On this step only signed attributes are generates
|
org.bouncycastle.cms.CMSSignedData |
prepareDetachedSign(byte[] content)
Prepare to Generates a digital signature from a content,
the result does not contains the content that was signed
On this step only signed attributes are generates
|
org.bouncycastle.cms.CMSSignedData |
prepareHashSign(byte[] hash)
Prepare to Generates a digital signature from a previous calculated hash for a content,
the result does not contains the original content that was signed
On this step only signed attributes are generates
|
org.bouncycastle.asn1.cms.AttributeTable |
prepareSignedAttributes(byte[] content,
byte[] previewSignature)
Recebe o conteúdo e uma assinatura prévia e prepara a tabela de atributos
assináveis.
|
void |
setAlgorithm(SignerAlgorithmEnum algorithm)
Set an algorithm pre-defined in enumeration.
|
void |
setAlgorithm(String algorithm)
Set a Signature Algorithm.
|
void |
setAttached(boolean attached) |
void |
setCertificateManager(CertificateManager certificateManager) |
void |
setCertificates(Certificate[] certificates)
Assign a Certificate for validate or generate a signature
|
void |
setCertificatesForTimeStamp(Certificate[] certificates)
Assign a Certificate for get timeStamp
|
void |
setDefaultCertificateValidators(boolean defaultCertificateValidators) |
void |
setHash(byte[] hash) |
void |
setNotAfterSignerCertificate(Date notAfterSignerCertificate) |
void |
setPades(boolean pades) |
void |
setPolicyName(String policyName) |
void |
setPrivateKey(PrivateKey privateKey)
Private key required for asymmetric cryptography
|
void |
setPrivateKeyForTimeStamp(PrivateKey privateKeyForTimeStamp)
the private key to use for request timestamp
|
void |
setProvider(Provider provider)
Indicates which Provider will be used.
|
void |
setPublicKey(PublicKey publicKey)
Public key needed for asymmetric cryptography
|
void |
setSignatory(String signatory) |
void |
setSignaturePolicy(PolicyFactory.Policies signaturePolicy)
Assign a Policy for validate or generate a signature
|
public CAdESSigner()
public CAdESSigner(String algorithm, PolicyFactory.Policies police)
public CAdESSigner(String algorithm, PolicyFactory.Policies police, boolean pades)
public org.bouncycastle.util.Store<?> generatedCertStore(Certificate[] previewCerts)
public String getAlgorithm()
SignergetAlgorithm in interface Signerpublic PrivateKey getPrivateKey()
SignergetPrivateKey in interface Signerpublic Provider getProvider()
SignergetProvider in interface Signerpublic PublicKey getPublicKey()
SignergetPublicKey in interface Signerpublic byte[] getHash()
public void setHash(byte[] hash)
public boolean isDefaultCertificateValidators()
public void setAlgorithm(SignerAlgorithmEnum algorithm)
SignersetAlgorithm in interface Signeralgorithm - algorithm representation to be usedpublic void setAlgorithm(String algorithm)
SignersetAlgorithm in interface Signeralgorithm - algorithm to be usedpublic boolean isAttached()
public void setAttached(boolean attached)
public void setCertificates(Certificate[] certificates)
PKCS7SignersetCertificates in interface PKCS7Signercertificates - certificate to be usedpublic void setDefaultCertificateValidators(boolean defaultCertificateValidators)
public void setPrivateKey(PrivateKey privateKey)
SignersetPrivateKey in interface SignerprivateKey - private key to be usedpublic void setProvider(Provider provider)
SignersetProvider in interface Signerprovider - provider to be usedpublic void setPublicKey(PublicKey publicKey)
SignersetPublicKey in interface SignerpublicKey - public key to be usedpublic void setSignaturePolicy(PolicyFactory.Policies signaturePolicy)
PKCS7SignersetSignaturePolicy in interface PKCS7SignersignaturePolicy - Signature policy to be usedpublic byte[] doAttachedSign(byte[] content)
SignerdoAttachedSign in interface Signercontent - content to be signedpublic byte[] doDetachedSign(byte[] content)
SignerdoDetachedSign in interface Signercontent - content to be signedpublic byte[] doAttachedSign(byte[] content,
byte[] previewSigned)
PKCS7SignerdoAttachedSign in interface PKCS7Signercontent - content to be signedpreviewSigned - CMS content from preview signedpublic byte[] doDetachedSign(byte[] content,
byte[] previewSigned)
PKCS7SignerdoDetachedSign in interface PKCS7Signercontent - content to be signedpreviewSigned - CMS content from preview signedpublic byte[] doCounterSign(byte[] previewCMSSignature)
PKCS7SignerdoCounterSign in interface PKCS7SignerpreviewCMSSignature - CMS content from preview signedpublic byte[] doHashSign(byte[] hash)
PKCS7SignerdoHashSign in interface PKCS7SignerdoHashSign in interface Signerhash - hash to be signedpublic byte[] doHashCoSign(byte[] hash,
byte[] previewSigned)
PKCS7SignerdoHashCoSign in interface PKCS7Signerhash - hash to be signedpreviewSigned - previous signaturepublic String getPolicyName()
public void setPolicyName(String policyName)
public CertificateManager getCertificateManager()
public void setCertificateManager(CertificateManager certificateManager)
public boolean isPades()
public void setPades(boolean pades)
public Date getNotAfterSignerCertificate()
SignergetNotAfterSignerCertificate in interface Signerpublic void setNotAfterSignerCertificate(Date notAfterSignerCertificate)
notAfterSignerCertificate - the notAfterSignerCertificate to setpublic void setCertificatesForTimeStamp(Certificate[] certificates)
PKCS7SignersetCertificatesForTimeStamp in interface PKCS7Signercertificates - certificate to be usedpublic void setPrivateKeyForTimeStamp(PrivateKey privateKeyForTimeStamp)
setPrivateKeyForTimeStamp in interface SignerprivateKeyForTimeStamp - to be used for request timestamppublic PrivateKey getPrivateKeyForTimeStamp()
getPrivateKeyForTimeStamp in interface Signerpublic String getSignatory()
getSignatory in interface Signerpublic void setSignatory(String signatory)
public org.bouncycastle.cms.CMSSignedData prepareDetachedSign(byte[] content)
SignerprepareDetachedSign in interface Signercontent - full content to signpublic org.bouncycastle.cms.CMSSignedData prepareAttachedSign(byte[] content)
SignerprepareAttachedSign in interface Signercontent - content to be signedpublic org.bouncycastle.cms.CMSSignedData prepareHashSign(byte[] hash)
SignerprepareHashSign in interface Signerhash - hash to be signedpublic byte[] envelopDetachedSign(org.bouncycastle.cms.CMSSignedData signedData)
SignerenvelopDetachedSign in interface SignersignedData - signed attributespublic byte[] envelopAttachedSign(org.bouncycastle.cms.CMSSignedData signedData)
SignerenvelopAttachedSign in interface SignersignedData - signed attributespublic byte[] envelopHashSign(org.bouncycastle.cms.CMSSignedData signedData)
SignerenvelopHashSign in interface SignersignedData - signed attributespublic byte[] envelopSignature(org.bouncycastle.cms.CMSSignedData cmsSignedData,
byte[] previewSignature)
public org.bouncycastle.asn1.cms.AttributeTable prepareSignedAttributes(byte[] content,
byte[] previewSignature)
content - Conteúdo que está sendo assinado, ou nullpreviewSignature - Assinatura prévia do mesmo conteúdo, para copiar os
certificadospublic AlgAndLength prepareAlgAndLength()
public Certificate[] extractCertificates(byte[] previewSignature)
previewSignature - Copyright © 2025 SERPRO - Serviço Federal de Processamento de Dados. All rights reserved.