Пример #1
0
  private void setSigningCertificateAndChain(
      final WSParameters wsParameters, final SignatureParameters params) {

    final byte[] signingCertBytes = wsParameters.getSigningCertificateBytes();
    if (signingCertBytes == null) {
      return;
    }
    final X509Certificate x509SigningCertificate = DSSUtils.loadCertificate(signingCertBytes);
    params.setSigningCertificate(x509SigningCertificate);

    final List<X509Certificate> chain = new ArrayList<X509Certificate>();
    chain.add(x509SigningCertificate);
    final List<byte[]> certificateChainByteArrayList =
        wsParameters.getCertificateChainByteArrayList();
    if (certificateChainByteArrayList != null) {

      for (final byte[] x509CertificateBytes : certificateChainByteArrayList) {

        final X509Certificate x509Certificate = DSSUtils.loadCertificate(x509CertificateBytes);
        if (!chain.contains(x509Certificate)) {

          chain.add(x509Certificate);
        }
      }
    }
    params.setCertificateChain(chain);
  }
Пример #2
0
  private void setClaimedSignerRole(
      final WSParameters wsParameters, final SignatureParameters params) {
    final List<String> claimedSignerRoles = wsParameters.getClaimedSignerRole();
    if (claimedSignerRoles != null) {
      for (final String claimedSignerRole : claimedSignerRoles) {

        params.bLevel().addClaimedSignerRole(claimedSignerRole);
      }
    }
  }
Пример #3
0
  private void setReferences(WSParameters wsParameters, SignatureParameters params) {

    final List<DSSReference> references = wsParameters.getReferences();
    //		System.out.println("###WS - REFERENCES:");
    //		if (references == null) {
    //
    //			System.out.println("    --> NULL");
    //			return;
    //		}
    //		for (DSSReference reference : references) {
    //			System.out.println("    --> " + reference.getId() + "/" + reference.getUri() + "/" +
    // reference.getType());
    //			final List<DSSTransform> transforms = reference.getTransforms();
    //			for (DSSTransform transform : transforms) {
    //
    //				System.out.println("    --> ---> " + transform.getElementName() + "/" +
    // transform.getTextContent() + "/" + transform.getAlgorithm());
    //			}
    //		}
    params.setReferences(references);
  }
Пример #4
0
 private void setAsicMimeType(WSParameters wsParameters, SignatureParameters params) {
   params.aSiC().setMimeType(wsParameters.getAsicMimeType());
 }
Пример #5
0
  private void setAsicZipComment(WSParameters wsParameters, SignatureParameters params) {

    params.aSiC().setZipComment(wsParameters.getAsicZipComment());
  }
Пример #6
0
  private void setSignatureLevel(WSParameters wsParameters, SignatureParameters params) {

    final SignatureLevel signatureLevel = wsParameters.getSignatureLevel();
    params.setSignatureLevel(signatureLevel);
  }
Пример #7
0
  private void setSignaturePackaging(
      final WSParameters wsParameters, final SignatureParameters params) {

    final SignaturePackaging signaturePackaging = wsParameters.getSignaturePackaging();
    params.setSignaturePackaging(signaturePackaging);
  }
Пример #8
0
  private void setSigningDate(final WSParameters wsParameters, final SignatureParameters params) {

    final Date signingDate = wsParameters.getSigningDate();
    params.bLevel().setSigningDate(signingDate);
  }
Пример #9
0
  private void setSignerLocation(WSParameters wsParameters, SignatureParameters params) {

    final BLevelParameters.SignerLocation signerLocation = wsParameters.getSignerLocation();
    params.bLevel().setSignerLocation(signerLocation);
  }
Пример #10
0
  private void setDigestAlgorithm(
      final WSParameters wsParameters, final SignatureParameters params) {

    final DigestAlgorithm digestAlgorithm = wsParameters.getDigestAlgorithm();
    params.setDigestAlgorithm(digestAlgorithm);
  }
Пример #11
0
  private void setDeterministicId(
      final WSParameters wsParameters, final SignatureParameters params) {

    final String deterministicId = wsParameters.getDeterministicId();
    params.setDeterministicId(deterministicId);
  }
Пример #12
0
  private void setEncryptionAlgorithm(WSParameters wsParameters, SignatureParameters params) {

    final EncryptionAlgorithm encryptionAlgorithm = wsParameters.getEncryptionAlgorithm();
    params.setEncryptionAlgorithm(encryptionAlgorithm);
  }
Пример #13
0
  private void setContentIdentifierPrefix(WSParameters wsParameters, SignatureParameters params) {

    final String contentIdentifierPrefix = wsParameters.getContentIdentifierPrefix();
    params.bLevel().setContentIdentifierPrefix(contentIdentifierPrefix);
  }
Пример #14
0
  private void setCommitmentTypeIndication(WSParameters wsParameters, SignatureParameters params) {

    final List<String> commitmentTypeIndication = wsParameters.getCommitmentTypeIndication();
    params.bLevel().setCommitmentTypeIndications(commitmentTypeIndication);
  }
Пример #15
0
 private void setAsicSignatureForm(WSParameters wsParameters, SignatureParameters params) {
   params.aSiC().setAsicSignatureForm(wsParameters.getAsicSignatureForm());
 }
Пример #16
0
  /**
   * Allows to change the default behaviour regarding the use of an expired certificate.
   *
   * @param wsParameters
   * @param params
   */
  private void setSignWithExpiredCertificate(
      final WSParameters wsParameters, final SignatureParameters params) {

    final boolean signWithExpiredCertificate = wsParameters.getSignWithExpiredCertificate();
    params.setSignWithExpiredCertificate(signWithExpiredCertificate);
  }
Пример #17
0
 private void setAsicEnclosedSignature(WSParameters wsParameters, SignatureParameters params) {
   params.aSiC().setEnclosedSignature(wsParameters.getAsicEnclosedSignature());
 }
Пример #18
0
  private void setSignaturePolicy(WSParameters wsParameters, SignatureParameters params) {

    final BLevelParameters.Policy signaturePolicy = wsParameters.getSignaturePolicy();
    params.bLevel().setSignaturePolicy(signaturePolicy);
  }