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); }
/** * Alternative constructor * * @param tspSource The TSPSource to be used for the Timestamp generation * @param certificatePool The CertificatePool to be used for the TimestampToken */ public TimestampService(final TSPSource tspSource, final CertificatePool certificatePool) { if (tspSource == null) { throw new DSSNullException(TSPSource.class); } this.tspSource = tspSource; if (certificatePool == null) { throw new DSSNullException(CertificatePool.class); } this.certificatePool = certificatePool; xPathQueryHolder = new XPathQueryHolder(); }
public void setCanonicalizationMethod(final String canonicalizationMethod) { if (DSSUtils.isBlank(canonicalizationMethod)) { throw new DSSNullException(String.class, "canonicalizationMethod"); } this.canonicalizationMethod = canonicalizationMethod; }
/** * The default constructor for XAdESCertificateSource. All certificates are extracted during instantiation. * * @param signatureElement {@code Element} that contains an XML signature * @param xPathQueryHolder adapted {@code XPathQueryHolder} * @param certificatePool {@code CertificatePool} to use to declare the found certificates */ public XAdESCertificateSource(final Element signatureElement, final XPathQueryHolder xPathQueryHolder, final CertificatePool certificatePool) { super(certificatePool); if (signatureElement == null) { throw new DSSNullException(Element.class, "signatureElement"); } if (xPathQueryHolder == null) { throw new DSSNullException(XPathQueryHolder.class, "xPathQueryHolder"); } this.signatureElement = signatureElement; this.xPathQueryHolder = xPathQueryHolder; extract(); if (LOG.isInfoEnabled()) { LOG.info("+XAdESCertificateSource"); } }
/** * The default constructor for XAdESSignature. * * @param signatureElement w3c.dom <ds:Signature> element * @param xPathQueryHolders List of {@code XPathQueryHolder} to use when handling signature * @param certPool can be null */ public XAdESSignature(final Element signatureElement, final List<XPathQueryHolder> xPathQueryHolders, final CertificatePool certPool) throws DSSNullException { super(certPool); if (signatureElement == null) { throw new DSSNullException(Element.class, "signatureElement"); } this.signatureElement = signatureElement; this.xPathQueryHolders = xPathQueryHolders; initialiseSettings(); }
/** * This method allows to set the {@code SigningCertificateValidity} object after the verification of its signature. {@code theSigningCertificateValidity} object must be in the * list of the candidates. * * @param theCertificateValidity the certain signing certificate validity object * @throws DSSException if the {@code SigningCertificateValidity} is not present in the list of candidates then the {@code DSSException} is frown. */ public void setTheCertificateValidity(final CertificateValidity theCertificateValidity) throws DSSException { if (theCertificateValidity == null) { throw new DSSNullException(CertificateValidity.class); } if (!certificateValidityList.contains(theCertificateValidity)) { throw new DSSException("theSigningCertificateValidity must be the part of the candidates!"); } this.theCertificateValidity = theCertificateValidity; }
/** * Adds a claimed signer role * * @param claimedSignerRole the value */ public void addClaimedSignerRole(final String claimedSignerRole) { final boolean empty = DSSUtils.isEmpty(claimedSignerRole); if (empty) { throw new DSSNullException(String.class, "claimedSignerRole"); } if (claimedSignerRoles == null) { claimedSignerRoles = new ArrayList<String>(); } claimedSignerRoles.add(claimedSignerRole); }