Package br.net.woodstock.rockframework.security.timestamp

Examples of br.net.woodstock.rockframework.security.timestamp.TimeStamp


      if (timeStampClient != null) {
        SignerInformationStore signerInformationStore = signedData.getSignerInfos();
        List list = new ArrayList();
        for (Object o : signerInformationStore.getSigners()) {
          SignerInformation signerInformation = (SignerInformation) o;
          TimeStamp timeStamp = timeStampClient.getTimeStamp(signerInformation.getSignature());
          ASN1Primitive asn1Primitive = BouncyCastleProviderHelper.toASN1Primitive(timeStamp.getEncoded());
          DERSet derSet = new DERSet(asn1Primitive);

          Hashtable hashtable = new Hashtable();
          Attribute attribute = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, derSet);
          hashtable.put(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, attribute);
View Full Code Here


                // ASN1ObjectIdentifier asn1ObjectIdentifier = (ASN1ObjectIdentifier)
                // derObjectIdentifier;
                DERSet set = (DERSet) derObjectValue;
                ASN1Encodable encodable = set.getObjectAt(0);
                TimeStampToken timeStampToken = new TimeStampToken(new CMSSignedData(encodable.toASN1Primitive().getEncoded()));
                TimeStamp timeStamp = BouncyCastleTimeStampHelper.toTimeStamp(timeStampToken);
                signature.setTimeStamp(timeStamp);
              }
            }
          }
View Full Code Here

    this.tokenSizeEstimate = DelegateTSAClient.TOKEN_SIZE;
  }

  @Override
  public byte[] getTimeStampToken(final byte[] imprint) throws Exception {
    TimeStamp timeStamp = this.client.getTimeStamp(imprint);
    this.timeStampToken = timeStamp.getEncoded();
    this.tokenSizeEstimate = this.timeStampToken.length + DelegateTSAClient.PADDING_SIZE;
    return this.timeStampToken;
  }
View Full Code Here

            byte[] content = string.getBytes();

            X509Certificate certificate = pk.getSigningCertificate();

            byte[] encoded = content;
            TimeStamp timeStamp = null;
            String location = pk.getLocation();
            String reason = pk.getReason();
            String signName = pk.getSignName();
            Date date = pk.getSignDate().getTime();
            Boolean valid = Boolean.TRUE;
View Full Code Here

      return null;
    }

    TimeStampTokenInfo timeStampTokenInfo = timeStampToken.getTimeStampInfo();

    TimeStamp timeStamp = new TimeStamp();
    timeStamp.setDate(timeStampTokenInfo.getGenTime());
    timeStamp.setEncoded(timeStampToken.getEncoded());
    timeStamp.setHash(timeStampTokenInfo.getMessageImprintDigest());
    timeStamp.setNonce(timeStampTokenInfo.getNonce());
    timeStamp.setSerialNumber(timeStampTokenInfo.getSerialNumber());

    CMSSignedData signedData = timeStampToken.toCMSSignedData();
    Object signedContent = signedData.getSignedContent().getContent();

    if ((signedContent != null) && (signedContent.getClass().isArray())) {
      timeStamp.setContent((byte[]) signedContent);
    }

    Store certificatesStore = timeStampToken.getCertificates();
    Collection certificatesCollection = certificatesStore.getMatches(null);
    List<Certificate> certificates = new ArrayList<Certificate>();
    for (Object obj : certificatesCollection) {
      if (obj instanceof X509CertificateHolder) {
        X509CertificateHolder holder = (X509CertificateHolder) obj;
        byte[] encoded = holder.getEncoded();
        Certificate certificate = Certificates.get(encoded);
        certificates.add(certificate);
      }
    }
    timeStamp.setCertificates(Collections.toArray(certificates, Certificate.class));

    return timeStamp;
  }
View Full Code Here

      if (timeStampClient != null) {
        SignerInformationStore signerInformationStore = signedData.getSignerInfos();
        List list = new ArrayList();
        for (Object o : signerInformationStore.getSigners()) {
          SignerInformation signerInformation = (SignerInformation) o;
          TimeStamp timeStamp = timeStampClient.getTimeStamp(signerInformation.getSignature());
          ASN1Primitive asn1Primitive = BouncyCastleProviderHelper.toASN1Primitive(timeStamp.getEncoded());
          DERSet derSet = new DERSet(asn1Primitive);

          Hashtable hashtable = new Hashtable();
          Attribute attribute = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, derSet);
          hashtable.put(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, attribute);
View Full Code Here

                // ASN1ObjectIdentifier asn1ObjectIdentifier = (ASN1ObjectIdentifier)
                // derObjectIdentifier;
                DERSet set = (DERSet) derObjectValue;
                ASN1Encodable encodable = set.getObjectAt(0);
                TimeStampToken timeStampToken = new TimeStampToken(new CMSSignedData(encodable.toASN1Primitive().getEncoded()));
                TimeStamp timeStamp = BouncyCastleTimeStampHelper.toTimeStamp(timeStampToken);
                signature.setTimeStamp(timeStamp);
              }
            }
          }
View Full Code Here

      if (timeStampClient != null) {
        SignerInformationStore signerInformationStore = signedData.getSignerInfos();
        List list = new ArrayList();
        for (Object o : signerInformationStore.getSigners()) {
          SignerInformation signerInformation = (SignerInformation) o;
          TimeStamp timeStamp = timeStampClient.getTimeStamp(signerInformation.getSignature());
          DERObject derObject = new ASN1InputStream(timeStamp.getEncoded()).readObject();
          DERSet derSet = new DERSet(derObject);

          Hashtable hashtable = new Hashtable();
          Attribute unsignAtt = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, derSet);
          hashtable.put(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, unsignAtt);
View Full Code Here

            X509Certificate certificate = pk.getSigningCertificate();
            Certificate[] chain = pk.getSignCertificateChain();

            byte[] encoded = content;
            TimeStamp timeStamp = null;
            String location = pk.getLocation();
            String reason = pk.getReason();
            Date date = pk.getSignDate().getTime();
            Boolean valid = Boolean.TRUE;
            Signatory signatory = this.toSignatory(certificate);
View Full Code Here

      return null;
    }

    TimeStampTokenInfo timeStampTokenInfo = timeStampToken.getTimeStampInfo();

    TimeStamp timeStamp = new TimeStamp();
    timeStamp.setDate(timeStampTokenInfo.getGenTime());
    timeStamp.setEncoded(timeStampToken.getEncoded());
    timeStamp.setHash(timeStampTokenInfo.getMessageImprintDigest());
    timeStamp.setNonce(timeStampTokenInfo.getNonce());
    timeStamp.setSerialNumber(timeStampTokenInfo.getSerialNumber());

    CMSSignedData signedData = timeStampToken.toCMSSignedData();
    Object signedContent = signedData.getSignedContent().getContent();

    if ((signedContent != null) && (signedContent.getClass().isArray())) {
      timeStamp.setContent((byte[]) signedContent);
    }

    Store certificatesStore = timeStampToken.getCertificates();
    Collection certificatesCollection = certificatesStore.getMatches(null);
    List<Certificate> certificates = new ArrayList<Certificate>();
    for (Object obj : certificatesCollection) {
      if (obj instanceof X509CertificateHolder) {
        X509CertificateHolder holder = (X509CertificateHolder) obj;
        byte[] encoded = holder.getEncoded();
        Certificate certificate = SecurityUtils.getCertificateFromFile(encoded, CertificateType.X509);
        certificates.add(certificate);
      }
    }
    timeStamp.setCertificates(certificates.toArray(new Certificate[certificates.size()]));

    return timeStamp;
  }
View Full Code Here

TOP

Related Classes of br.net.woodstock.rockframework.security.timestamp.TimeStamp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.