public void setCurrentTime(final Date currentTime) throws DSSException { if (currentTime == null) { throw new DSSNullException(Date.class, "currentTime"); } this.currentTime = currentTime; }
/** * The default constructor with a mandatory shared certificates pool. * * @param certPool shared (external) {@code CertificatePool} */ public CommonCertificateSource(final CertificatePool certPool) { if (certPool == null) { throw new DSSNullException(CertificatePool.class); } this.certPool = certPool; }
public TimestampReference(final String digestAlgorithm, final String digestValue) { if (digestAlgorithm == null) { throw new DSSNullException(String.class, "digestAlgorithm"); } this.digestAlgorithm = digestAlgorithm; if (digestValue == null) { throw new DSSNullException(String.class, "digestValue"); } this.digestValue = digestValue; this.category = TimestampReferenceCategory.CERTIFICATE; }
/** * This is the default constructor. * * @param x509Certificate encapsulated {@code X509Certificate} */ public ChainCertificate(final X509Certificate x509Certificate) { if (x509Certificate == null) { throw new DSSNullException(X509Certificate.class); } this.x509Certificate = x509Certificate; }
public void setDigestAlgorithm(final DigestAlgorithm digestAlgorithm) { if (digestAlgorithm == null) { throw new DSSNullException(DigestAlgorithm.class); } this.digestAlgorithm = digestAlgorithm; }
/** * The default constructor for CriteriaListCondition. * * @param matchingCriteriaIndicator matching criteria indicator: atLeastOne, all, none */ public CriteriaListCondition(final MatchingCriteriaIndicator matchingCriteriaIndicator) { if (matchingCriteriaIndicator == null) { throw new DSSNullException(MatchingCriteriaIndicator.class); } this.matchingCriteriaIndicator = matchingCriteriaIndicator; }
/** * To construct a signature service the <code>CertificateVerifier</code> must be set and cannot be null. * * @param certificateVerifier {@code CertificateVerifier} provides information on the sources to be used in the validation process in the context of a signature. */ protected AbstractSignatureService(final CertificateVerifier certificateVerifier) { if (certificateVerifier == null) { throw new DSSNullException(CertificateVerifier.class); } this.certificateVerifier = certificateVerifier; }
private void ensureNotNull(final CRLValidity crlValidity) { if (crlValidity == null) { throw new DSSNullException(CRLValidity.class); } if (crlValidity.x509CRL == null) { throw new DSSNullException(X509CRL.class); } }
/** * Set the DataLoader to use for querying the OCSP server. * * @param dataLoader the component that allows to retrieve the OCSP response using HTTP. * @throws DSSNullException in the case of {@code null} parameter value */ public void setDataLoader(final DataLoader dataLoader) throws DSSNullException { if (dataLoader == null) { throw new DSSNullException(DataLoader.class); } this.dataLoader = dataLoader; }
/** * Set the DataLoader to use for querying the CRL server * * @param dataLoader the component that allows to retrieve the data using any protocol: HTTP, HTTPS, FTP, LDAP. * @throws DSSNullException in the case of {@code null} parameter value */ public void setDataLoader(final DataLoader dataLoader) throws DSSNullException { if (dataLoader == null) { throw new DSSNullException(DataLoader.class); } this.dataLoader = dataLoader; }
/** * The default constructor for PolicyIdCondition. * * @param policyId */ public PolicyIdCondition(final String policyId) { if (policyId == null) { throw new DSSNullException(StrictMath.class, "policyId"); } this.policyOid = policyId; }
/** * The default constructor for CMSSignedDocument. * * @param data * @throws IOException */ public CMSSignedDocument(final CMSSignedData data) throws DSSException { this.signedData = data; if (data == null) { throw new DSSNullException(CMSSignedData.class); } mimeType = MimeType.PKCS7; }
public static String toString(final byte[] bytes) { if (bytes == null) { throw new DSSNullException(byte[].class); } final String string = new String(bytes); return string; }
@Override public void defineSigningCertificate(final X509Certificate x509Certificate) { if (x509Certificate == null) { throw new DSSNullException(X509Certificate.class); } if (validationCertPool == null) { throw new DSSNullException(CertificatePool.class, "validationCertPool"); } providedSigningCertificateToken = validationCertPool.getInstance(x509Certificate, CertificateSourceType.OTHER); }
public void setCanonicalizationMethod(final String canonicalizationMethod) { if (DSSUtils.isBlank(canonicalizationMethod)) { throw new DSSNullException(String.class, "canonicalizationMethod"); } this.canonicalizationMethod = canonicalizationMethod; }
/** * Basic constructor, new CertificatePool created * * @param tspSource The TSPSource to be used for the Timestamp generation */ public TimestampService(final TSPSource tspSource) { if (tspSource == null) { throw new DSSNullException(TSPSource.class); } this.tspSource = tspSource; certificatePool = new CertificatePool(); xPathQueryHolder = new XPathQueryHolder(); }
public TimestampReference(final String signatureId) { if (signatureId == null) { throw new DSSNullException(String.class, "signatureId"); } this.signatureId = signatureId; this.digestAlgorithm = DigestAlgorithm.SHA1.name(); this.digestValue = DSSUtils.base64Encode(DSSUtils.digest(DigestAlgorithm.SHA1, signatureId.getBytes())); this.category = TimestampReferenceCategory.SIGNATURE; }
@Override public DSSDocument signDocument(final DSSDocument toSignDocument, final SignatureParameters parameters) throws DSSException { final SignatureTokenConnection token = parameters.getSigningToken(); if (token == null) { throw new DSSNullException(SignatureTokenConnection.class, "", "The connection through the available API to the SSCD must be set."); } final byte[] dataToSign = getDataToSign(toSignDocument, parameters); final byte[] signatureValue = token.sign(dataToSign, parameters.getDigestAlgorithm(), parameters.getPrivateKeyEntry()); final DSSDocument dssDocument = signDocument(toSignDocument, parameters, signatureValue); return dssDocument; } }
@Override public DSSDocument signDocument(final DSSDocument toSignDocument, final SignatureParameters parameters) throws DSSException { final SignatureTokenConnection token = parameters.getSigningToken(); if (token == null) { throw new DSSNullException(SignatureTokenConnection.class, "", "The connection through available API to the SSCD must be set."); } final byte[] dataToSign = getDataToSign(toSignDocument, parameters); byte[] signatureValue = token.sign(dataToSign, parameters.getDigestAlgorithm(), parameters.getPrivateKeyEntry()); final DSSDocument document = signDocument(toSignDocument, parameters, signatureValue); return document; }
@Override public DSSDocument signDocument(final DSSDocument toSignDocument, final SignatureParameters parameters) throws DSSException { final byte[] dataToSign = getDataToSign(toSignDocument, parameters); final SignatureTokenConnection signingToken = parameters.getSigningToken(); if (signingToken == null) { throw new DSSNullException(SignatureTokenConnection.class); } final DigestAlgorithm digestAlgorithm = parameters.getDigestAlgorithm(); final DSSPrivateKeyEntry privateKeyEntry = parameters.getPrivateKeyEntry(); final byte[] signatureValue = signingToken.sign(dataToSign, digestAlgorithm, privateKeyEntry); final DSSDocument dssDocument = signDocument(toSignDocument, parameters, signatureValue); return dssDocument; }