Ejemplo n.º 1
0
  public static Signature finalizeXadesC(SignedDoc sdoc, Signature sig) throws DigiDocException {
    if (m_logger.isDebugEnabled())
      m_logger.debug("Finalize XAdES-C: " + sig.getId() + " profile: " + sig.getProfile());
    CompleteRevocationRefs rrefs = new CompleteRevocationRefs();
    CompleteCertificateRefs crefs = new CompleteCertificateRefs();
    UnsignedProperties usp = sig.getUnsignedProperties();
    if (usp == null) {
      usp = new UnsignedProperties(sig);
      sig.setUnsignedProperties(usp);
    }
    usp.setCompleteCertificateRefs(crefs);
    usp.setCompleteRevocationRefs(rrefs);
    rrefs.setUnsignedProperties(usp);
    crefs.setUnsignedProperties(usp);
    sig.setUnsignedProperties(usp);
    sig.setProfile(SignedDoc.BDOC_PROFILE_CL);
    // TODO: update certs and refs

    return sig;
  }
 /**
  * Adds a new CertID object
  *
  * @param cid new object to be added
  */
 public void addCertID(CertID cid) {
   m_unsignedProps.getSignature().addCertID(cid);
 }
 /**
  * return the count of CertID objects
  *
  * @return count of CertID objects
  */
 public int countCertIDs() {
   return m_unsignedProps.getSignature().countCertIDs();
 }
 /**
  * Retrieves CertID element with the desired type. If not found creates a new one with this type.
  *
  * @param type CertID type
  * @return CertID element
  * @throws DigiDocException for validation errors
  */
 public CertID getOrCreateCertIdOfType(int type) throws DigiDocException {
   return m_unsignedProps.getSignature().getOrCreateCertIdOfType(type);
 }
 /**
  * Retrieves CertID element with the desired type
  *
  * @param type CertID type
  * @return CertID element or null if not found
  */
 public CertID getCertIdOfType(int type) {
   return m_unsignedProps.getSignature().getCertIdOfType(type);
 }
 /**
  * Retrieves the last CertID element
  *
  * @return CertID element or null if not found
  */
 public CertID getLastCertId() {
   return m_unsignedProps.getSignature().getLastCertId();
 }
 /**
  * Retrieves CertID element with the desired index
  *
  * @param idx CertID index
  * @return CertID element or null if not found
  */
 public CertID getCertID(int idx) {
   return m_unsignedProps.getSignature().getCertID(idx);
 }