Can I digitally sign a SECURED document?

I have a user who has received a SECURED document. I have attached the document properties page. My user would like to digitally sign this document. But, when she/I try to sign the document, the Signature option is grayed out. Can SECURED documents be signed? I am able to sign other documents.

Just to clarify what George Johnson meant. First, before you secure your PDF you need to add unsigned signature field (one or more) at the places in the document where you want the signatures to appear. Then you secure your PDF. Tehn you can sign it in the already existing unsigned signature field. If you received secured PDF from someone else and it does not contain unsigned signature fields then you cannot sign it.

Similar Messages

  • How can I digitally sign a pdf document and also disallow changes to the document?

    When I digitally sign the document it does not let me lock it down - when I lock down the doc first, it does not allow for digital signature. Please help.

    The initial document should have its properties set as:
    Changing the Document: Not allowed
    Signing: Allowed
    That way no one can make changes to it but anyone may sign it. These properties are available in v9, but I'm not sure about previous versions.

  • Why can't I sign a PDF document?

    When I select the "Sign" pane, all of the options are greyed-out. What is wrong and how can I fix it?

    That depends on the document, though some people are also reporting problems with the lastest Reader update. If the document is secured ij a way that would preclude adding e-signatures, you won't be able to add them. If you're wanting to digitally sign, then the document needs to be specifically enabled for this, either by Acrobat Pro or LiveCycle Reader Extensions. THis is something the creator of the document must do before distributing it.

  • Have been using successfully Acrobat 8 Standard, version 8.3.1 for years.  Suddenly can not digitally sign anything because software can not find "existing digital ID file?

    Have been using successfully Acrobat 8 Standard, version 8.3.1 for years.  Suddenly can not digitally sign anything because software can not find "existing digital ID file?

    Are you still using Acrobat 8? If not read further.
    All Acrobat versions prior to 11.0.07 had a security flaw that they allows signing with certificates that had "Extended Key Usage" (EKU) restricted to certain certificate uses and those did not include document signing. Most frequently those were certificates with "Client Auth" or "Server Auth" in EKU. Acrobat/Reader 11.0.07 fixed this problem, which also means that while previous versions accepted such certificates for signing 11.0.07 and later do not.

  • Can't digitally sign document

    Since we have upgraded to Reader version 9, anytime we send a PDF through email that requires a digital signature. The digital signature option is grayed out. When you check the properties of the document it says that digital signatures are not available. If we try the same document with Reader version 8 we are able to digitally sign the document. Are we doing something wrong when creating the documents? We use Adobe Acrobat 7 Professional for creating the documents. Any help would greatly be appreciated. I can send one of the documents if someone things they know what may be wrong.

    Similar issues here, but the document properties say that it is allowed.
    I am new to this and this is the first time I've set it up. It appears that I have everything done but it still won't let me sign.

  • How to digitally sign a scanned document

    We have copiers and a large format scanner that can create PDF files. We would like to be able to affix digital signatures to these documents. The application is that we create plan sets for public construction projects and those are 'stamped' with a seal. We would like to start doing that electronically if possible. We have Adobe Acrobat Pro verson 8.

    If you really want a digital signature, you can easily add one in Acrobat. I don't have Acrobat 8 to tell you exactly how you'd do it, but the Acrobat help doc should have more information. In Acrobat 9, you do it by selecting: Advanced > Sign & Certify > Place Signature
    or: File > Save as Certified Document
    You will first have to set up a digital identity. In Acrobat 9 you do this by selecting: Advanced > Security Settings > Digital IDs > Add ID
    You can create digital signature appearances that get used with a digital signature. To configure one, select (again, Acrobat 9): Edit > Preferences > Security > Digital Signatures > Appearance > New (or Edit)
    If you don't need all that a digital signature provides, you can use a stamp, perhaps a dynamic one, to add your seal. You can then flatten the page to convert the stamp annotation to regular page contents, preventing a user from altering it.

  • Problem Digitally signing an xml document "Cannot resolve element"

    I am trying to sign a cXML document. I try to add 3 references to the XMLSignatureFactory but when it hits the 2nd on it throws an error "Cannot resolve element with ID cXMLData". How come I can't add more than 1?
    Here is the stack trace :
    java.lang.RuntimeException: javax.xml.crypto.dsig.XMLSignatureException: javax.xml.crypto.URIReferenceException: com.sun.org.apache.xml.internal.security.utils.res olver.ResourceResolverException: Cannot resolve element with ID cXMLData
    at com.praxair.security.b2b.CXMLDigitalSig.sign(CXMLD igitalSig.java:303)
    at com.praxair.security.b2b.CXMLDigitalSig.main(CXMLD igitalSig.java:359)
    Java Code:
    public class CXMLDigitalSig
         private XMLSignatureFactory factory;
         private KeyStore keyStore;
         private KeyPair keyPair;
         private KeyInfo keyInfo;
         private X509Certificate signingCert;
         public CXMLDigitalSig()
         private void loadCert() throws Exception
              //String keystoreFile = config.getString(KEY_STORE_FILE);
              //String password = config.getString(KEY_STORE_PASSWORD);
              //String alias = config.getString(KEY_STORE_ALIAS);
              String keystoreFile = "C:\\cxmlsign\\teststore";
              String password = "xxxxx";
              String alias = "xxxxx (thawte ssl ca)";
              keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
              File file = new File(keystoreFile);
              FileInputStream inStream = new FileInputStream(file);
              char [] passAsChar = password.toCharArray();          
              keyStore.load(inStream, passAsChar);
              inStream.close();
              String providerName = System.getProperty("jsr105Provider",
                        "org.jcp.xml.dsig.internal.dom.XMLDSigRI");
              factory = XMLSignatureFactory.getInstance("DOM", (Provider) Class
                        .forName(providerName).newInstance());
              KeyStore.PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry) keyStore
                        .getEntry(alias, new KeyStore.PasswordProtection(passAsChar));
              signingCert = (X509Certificate) entry.getCertificate();
              keyPair = new KeyPair(entry.getCertificate().getPublicKey(),
                        entry.getPrivateKey());
              KeyInfoFactory kFactory = factory.getKeyInfoFactory();
              keyInfo = kFactory.newKeyInfo(Collections.singletonList(kFactory
                        .newX509Data(Collections.singletonList(entry
                                  .getCertificate()))));
          * This method returns the message digest for given certificate.
          * @param cert
          * @return
          * @throws NoSuchAlgorithmException
          * @throws CertificateEncodingException
         private static String getThumbPrint(X509Certificate cert)
                   throws NoSuchAlgorithmException, CertificateEncodingException {
              MessageDigest md = MessageDigest.getInstance("SHA-1");
              byte[] der = cert.getEncoded();
              md.update(der);
              byte[] digest = md.digest();
              return hexify(digest);
         private static String hexify(byte bytes[]) {
              char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                        'a', 'b', 'c', 'd', 'e', 'f' };
              StringBuffer buf = new StringBuffer(bytes.length * 2);
              for (int i = 0; i < bytes.length; ++i) {
                   buf.append(hexDigits[(bytes[i] & 0xf0) >> 4]);
                   buf.append(hexDigits[bytes[i] & 0x0f]);
              return buf.toString();
          * Adds an enveloped signature to the given document. The signature is
          * generated as per the CXML specfication outlined in the CXML user guide.
          * This method creates the signature and three references and also the XADES
          * information.
         public void sign(Element cxmlElement, String payloadId) throws SQLException {
              Reference ref1;
              Reference ref2;
              Reference ref3;
              List<Reference> refs = new ArrayList<Reference>();
              SignedInfo signedInfo;
              try {
                   ref1 = factory.newReference("#cXMLSignedInfo",
                             factory.newDigestMethod(DigestMethod.SHA1, null), null,
                             null, null);
                   refs.add(ref1);
                   ref2 = factory.newReference("#cXMLData",
                             factory.newDigestMethod(DigestMethod.SHA1, null), null,
                             null, null);
                   refs.add(ref2);
                   ref3 = factory.newReference("#XAdESSignedProps",
                             factory.newDigestMethod(DigestMethod.SHA1, null));
                   refs.add(ref3);
                   signedInfo = factory.newSignedInfo(factory
                             .newCanonicalizationMethod(
                                       CanonicalizationMethod.INCLUSIVE,
                                       (C14NMethodParameterSpec) null), factory
                             .newSignatureMethod(SignatureMethod.RSA_SHA1, null), refs);
              } catch (NoSuchAlgorithmException e) {
                   throw new RuntimeException(e);
              } catch (InvalidAlgorithmParameterException e) {
                   throw new RuntimeException(e);
              List<DOMStructure> xmlObjSignedInfo = new ArrayList<DOMStructure>();
              Element signedInfoElement = createElement(cxmlElement,
                        "cXMLSignedInfo", null, null);
              signedInfoElement.setAttributeNS(null, "Id", "cXMLSignedInfo");
              signedInfoElement.setAttributeNS(null, "payloadID", payloadId);
              signedInfoElement.setAttributeNS(null, "signatureVersion", "1.0");
              DOMStructure signedInfoStruct = new DOMStructure(signedInfoElement);
              xmlObjSignedInfo.add(signedInfoStruct);
              String xadesNS = "http://uri.etsi.org/01903/v1.1.1#";
              // Create the necessary XADES information as outlined in the CXML
              // specification
              Element QPElement = createElement(cxmlElement, "QualifyingProperties",
                        "xades", xadesNS);
              QPElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
                        "xmlns:xades", xadesNS);
              QPElement.setAttributeNS(null, "Target", "#cXMLSignature");
              Element SPElement = createElement(cxmlElement, "SignedProperties",
                        "xades", xadesNS);
              SPElement.setAttributeNS(null, "Id", "XAdESSignedProps");
              IdResolver.registerElementById(SPElement, "XAdESSignedProps");
              QPElement.appendChild(SPElement);
              Element signedSPElement = createElement(cxmlElement,
                        "SignedSignatureProperties", "xades", xadesNS);
              Element signingTimeElement = createElement(cxmlElement, "SigningTime",
                        "xades", xadesNS);
              SimpleDateFormat dateFormatter = new SimpleDateFormat(
                        "yyyy-MM-dd'T'HH:mm:ss");
              signingTimeElement.appendChild(cxmlElement.getOwnerDocument()
                        .createTextNode(dateFormatter.format(new Date())));
              signedSPElement.appendChild(signingTimeElement);
              SPElement.appendChild(signedSPElement);
              String certDigest = "";
              try {
                   certDigest = getThumbPrint(signingCert);
              } catch (CertificateEncodingException ce) {
                   throw new RuntimeException(ce);
              } catch (NoSuchAlgorithmException ne) {
                   throw new RuntimeException(ne);
              Element signingCertificateElement = createElement(cxmlElement,
                        "SigningCertificate", "xades", xadesNS);
              Element certElement = createElement(cxmlElement, "Cert", "xades",
                        xadesNS);
              Element certDigestElement = createElement(cxmlElement, "CertDigest",
                        "xades", xadesNS);
              Element digestMethodElement = createElement(cxmlElement,
                        "DigestMethod", "ds", XMLSignature.XMLNS);
              digestMethodElement
                        .setAttributeNS(null, "Algorithm", DigestMethod.SHA1);
              Element digestValueElement = createElement(cxmlElement, "DigestValue",
                        "ds", XMLSignature.XMLNS);
              digestValueElement.appendChild(cxmlElement.getOwnerDocument()
                        .createTextNode(certDigest));
              Element issuerSerialElement = createElement(cxmlElement,
                        "IssuerSerial", "xades", xadesNS);
              Element x509IssuerNameElement = createElement(cxmlElement,
                        "X509IssuerName", "ds", XMLSignature.XMLNS);
              x509IssuerNameElement
                        .appendChild(cxmlElement.getOwnerDocument().createTextNode(
                                  signingCert.getIssuerX500Principal().toString()));
              Element x509IssuerSerialNumberElement = createElement(cxmlElement,
                        "X509IssuerSerialNumber", "ds", XMLSignature.XMLNS);
              x509IssuerSerialNumberElement.appendChild(cxmlElement
                        .getOwnerDocument().createTextNode(
                                  signingCert.getSerialNumber().toString()));
              certDigestElement.appendChild(digestMethodElement);
              certDigestElement.appendChild(digestValueElement);
              certElement.appendChild(certDigestElement);
              issuerSerialElement.appendChild(x509IssuerNameElement);
              issuerSerialElement.appendChild(x509IssuerSerialNumberElement);
              certElement.appendChild(issuerSerialElement);
              signingCertificateElement.appendChild(certElement);
              signedSPElement.appendChild(signingCertificateElement);
              DOMStructure qualifPropStruct = new DOMStructure(QPElement);
              List<DOMStructure> xmlObjQualifyingProperty = new ArrayList<DOMStructure>();
              xmlObjQualifyingProperty.add(qualifPropStruct);
              XMLObject objectSingedInfo = factory.newXMLObject(xmlObjSignedInfo,
                        null, null, null);
              XMLObject objectQualifyingProperty = factory.newXMLObject(
                        xmlObjQualifyingProperty, null, null, null);
              // Create the ds:object tags
              List<XMLObject> objects = new ArrayList<XMLObject>();
              objects.add(objectSingedInfo);
              objects.add(objectQualifyingProperty);
              XMLSignature signature = factory.newXMLSignature(signedInfo, keyInfo,
                        objects, "cXMLSignature", null);
              DOMSignContext signContext = new DOMSignContext(keyPair.getPrivate(),
                        cxmlElement);
              signContext.putNamespacePrefix(XMLSignature.XMLNS, "ds");
              try {
                   signature.sign(signContext);
              } catch (MarshalException e) {
                   throw new RuntimeException(e);
              } catch (XMLSignatureException e) {
                   throw new RuntimeException(e);
         private Element createElement(Element element, String tag, String prefix,
                   String nsURI) {
              String qName = prefix == null ? tag : prefix + ":" + tag;
              return element.getOwnerDocument().createElementNS(nsURI, qName);
         X509Certificate getSigningCert() {
              return signingCert;
         private static String readFileAsString(String filePath)     throws java.io.IOException
              byte[] buffer = new byte[(int) new File(filePath).length()];
              BufferedInputStream f = null;
              try {
                   f = new BufferedInputStream(new FileInputStream(filePath));
                   f.read(buffer);
              } finally {
                   if (f != null) {
                        try {
                             f.close();
                        } catch (IOException ignored) {
              return new String(buffer);
         public static void main(String args[])
              System.out.println("start");
              CXMLDigitalSig cXMLDigitalSig = new CXMLDigitalSig();
              try
                   cXMLDigitalSig.loadCert();
                      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                      dbf.setNamespaceAware(true);
                   String cXML = readFileAsString("C:\\cxmlsign\\cxml.xml");
                      Document cxmlDocument = dbf.newDocumentBuilder()
                                                 .parse(new ByteArrayInputStream(cXML
                                                           .getBytes("UTF-8")));
                   System.out.println(cxmlDocument.getDocumentElement().getTagName());
                      cXMLDigitalSig.sign(cxmlDocument.getDocumentElement(), "55");
              catch(Exception e)
                   //System.out.println(e.getMessage());
                   System.out.println(getStackTrace(e));
                 System.out.println("end");
           public static String getStackTrace(Throwable aThrowable) {
                  final Writer result = new StringWriter();
                  final PrintWriter printWriter = new PrintWriter(result);
                  aThrowable.printStackTrace(printWriter);
                  return result.toString();
    }Edited by: sabre150 on Jan 18, 2012 1:57 PM
    Moderator action : added [ code ] tags to format source code

    I am trying to sign a cXML document. I try to add 3 references to the XMLSignatureFactory but when it hits the 2nd on it throws an error "Cannot resolve element with ID cXMLData". How come I can't add more than 1?
    Here is the stack trace :
    java.lang.RuntimeException: javax.xml.crypto.dsig.XMLSignatureException: javax.xml.crypto.URIReferenceException: com.sun.org.apache.xml.internal.security.utils.res olver.ResourceResolverException: Cannot resolve element with ID cXMLData
    at com.praxair.security.b2b.CXMLDigitalSig.sign(CXMLD igitalSig.java:303)
    at com.praxair.security.b2b.CXMLDigitalSig.main(CXMLD igitalSig.java:359)
    Java Code:
    public class CXMLDigitalSig
         private XMLSignatureFactory factory;
         private KeyStore keyStore;
         private KeyPair keyPair;
         private KeyInfo keyInfo;
         private X509Certificate signingCert;
         public CXMLDigitalSig()
         private void loadCert() throws Exception
              //String keystoreFile = config.getString(KEY_STORE_FILE);
              //String password = config.getString(KEY_STORE_PASSWORD);
              //String alias = config.getString(KEY_STORE_ALIAS);
              String keystoreFile = "C:\\cxmlsign\\teststore";
              String password = "xxxxx";
              String alias = "xxxxx (thawte ssl ca)";
              keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
              File file = new File(keystoreFile);
              FileInputStream inStream = new FileInputStream(file);
              char [] passAsChar = password.toCharArray();          
              keyStore.load(inStream, passAsChar);
              inStream.close();
              String providerName = System.getProperty("jsr105Provider",
                        "org.jcp.xml.dsig.internal.dom.XMLDSigRI");
              factory = XMLSignatureFactory.getInstance("DOM", (Provider) Class
                        .forName(providerName).newInstance());
              KeyStore.PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry) keyStore
                        .getEntry(alias, new KeyStore.PasswordProtection(passAsChar));
              signingCert = (X509Certificate) entry.getCertificate();
              keyPair = new KeyPair(entry.getCertificate().getPublicKey(),
                        entry.getPrivateKey());
              KeyInfoFactory kFactory = factory.getKeyInfoFactory();
              keyInfo = kFactory.newKeyInfo(Collections.singletonList(kFactory
                        .newX509Data(Collections.singletonList(entry
                                  .getCertificate()))));
          * This method returns the message digest for given certificate.
          * @param cert
          * @return
          * @throws NoSuchAlgorithmException
          * @throws CertificateEncodingException
         private static String getThumbPrint(X509Certificate cert)
                   throws NoSuchAlgorithmException, CertificateEncodingException {
              MessageDigest md = MessageDigest.getInstance("SHA-1");
              byte[] der = cert.getEncoded();
              md.update(der);
              byte[] digest = md.digest();
              return hexify(digest);
         private static String hexify(byte bytes[]) {
              char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                        'a', 'b', 'c', 'd', 'e', 'f' };
              StringBuffer buf = new StringBuffer(bytes.length * 2);
              for (int i = 0; i < bytes.length; ++i) {
                   buf.append(hexDigits[(bytes[i] & 0xf0) >> 4]);
                   buf.append(hexDigits[bytes[i] & 0x0f]);
              return buf.toString();
          * Adds an enveloped signature to the given document. The signature is
          * generated as per the CXML specfication outlined in the CXML user guide.
          * This method creates the signature and three references and also the XADES
          * information.
         public void sign(Element cxmlElement, String payloadId) throws SQLException {
              Reference ref1;
              Reference ref2;
              Reference ref3;
              List<Reference> refs = new ArrayList<Reference>();
              SignedInfo signedInfo;
              try {
                   ref1 = factory.newReference("#cXMLSignedInfo",
                             factory.newDigestMethod(DigestMethod.SHA1, null), null,
                             null, null);
                   refs.add(ref1);
                   ref2 = factory.newReference("#cXMLData",
                             factory.newDigestMethod(DigestMethod.SHA1, null), null,
                             null, null);
                   refs.add(ref2);
                   ref3 = factory.newReference("#XAdESSignedProps",
                             factory.newDigestMethod(DigestMethod.SHA1, null));
                   refs.add(ref3);
                   signedInfo = factory.newSignedInfo(factory
                             .newCanonicalizationMethod(
                                       CanonicalizationMethod.INCLUSIVE,
                                       (C14NMethodParameterSpec) null), factory
                             .newSignatureMethod(SignatureMethod.RSA_SHA1, null), refs);
              } catch (NoSuchAlgorithmException e) {
                   throw new RuntimeException(e);
              } catch (InvalidAlgorithmParameterException e) {
                   throw new RuntimeException(e);
              List<DOMStructure> xmlObjSignedInfo = new ArrayList<DOMStructure>();
              Element signedInfoElement = createElement(cxmlElement,
                        "cXMLSignedInfo", null, null);
              signedInfoElement.setAttributeNS(null, "Id", "cXMLSignedInfo");
              signedInfoElement.setAttributeNS(null, "payloadID", payloadId);
              signedInfoElement.setAttributeNS(null, "signatureVersion", "1.0");
              DOMStructure signedInfoStruct = new DOMStructure(signedInfoElement);
              xmlObjSignedInfo.add(signedInfoStruct);
              String xadesNS = "http://uri.etsi.org/01903/v1.1.1#";
              // Create the necessary XADES information as outlined in the CXML
              // specification
              Element QPElement = createElement(cxmlElement, "QualifyingProperties",
                        "xades", xadesNS);
              QPElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
                        "xmlns:xades", xadesNS);
              QPElement.setAttributeNS(null, "Target", "#cXMLSignature");
              Element SPElement = createElement(cxmlElement, "SignedProperties",
                        "xades", xadesNS);
              SPElement.setAttributeNS(null, "Id", "XAdESSignedProps");
              IdResolver.registerElementById(SPElement, "XAdESSignedProps");
              QPElement.appendChild(SPElement);
              Element signedSPElement = createElement(cxmlElement,
                        "SignedSignatureProperties", "xades", xadesNS);
              Element signingTimeElement = createElement(cxmlElement, "SigningTime",
                        "xades", xadesNS);
              SimpleDateFormat dateFormatter = new SimpleDateFormat(
                        "yyyy-MM-dd'T'HH:mm:ss");
              signingTimeElement.appendChild(cxmlElement.getOwnerDocument()
                        .createTextNode(dateFormatter.format(new Date())));
              signedSPElement.appendChild(signingTimeElement);
              SPElement.appendChild(signedSPElement);
              String certDigest = "";
              try {
                   certDigest = getThumbPrint(signingCert);
              } catch (CertificateEncodingException ce) {
                   throw new RuntimeException(ce);
              } catch (NoSuchAlgorithmException ne) {
                   throw new RuntimeException(ne);
              Element signingCertificateElement = createElement(cxmlElement,
                        "SigningCertificate", "xades", xadesNS);
              Element certElement = createElement(cxmlElement, "Cert", "xades",
                        xadesNS);
              Element certDigestElement = createElement(cxmlElement, "CertDigest",
                        "xades", xadesNS);
              Element digestMethodElement = createElement(cxmlElement,
                        "DigestMethod", "ds", XMLSignature.XMLNS);
              digestMethodElement
                        .setAttributeNS(null, "Algorithm", DigestMethod.SHA1);
              Element digestValueElement = createElement(cxmlElement, "DigestValue",
                        "ds", XMLSignature.XMLNS);
              digestValueElement.appendChild(cxmlElement.getOwnerDocument()
                        .createTextNode(certDigest));
              Element issuerSerialElement = createElement(cxmlElement,
                        "IssuerSerial", "xades", xadesNS);
              Element x509IssuerNameElement = createElement(cxmlElement,
                        "X509IssuerName", "ds", XMLSignature.XMLNS);
              x509IssuerNameElement
                        .appendChild(cxmlElement.getOwnerDocument().createTextNode(
                                  signingCert.getIssuerX500Principal().toString()));
              Element x509IssuerSerialNumberElement = createElement(cxmlElement,
                        "X509IssuerSerialNumber", "ds", XMLSignature.XMLNS);
              x509IssuerSerialNumberElement.appendChild(cxmlElement
                        .getOwnerDocument().createTextNode(
                                  signingCert.getSerialNumber().toString()));
              certDigestElement.appendChild(digestMethodElement);
              certDigestElement.appendChild(digestValueElement);
              certElement.appendChild(certDigestElement);
              issuerSerialElement.appendChild(x509IssuerNameElement);
              issuerSerialElement.appendChild(x509IssuerSerialNumberElement);
              certElement.appendChild(issuerSerialElement);
              signingCertificateElement.appendChild(certElement);
              signedSPElement.appendChild(signingCertificateElement);
              DOMStructure qualifPropStruct = new DOMStructure(QPElement);
              List<DOMStructure> xmlObjQualifyingProperty = new ArrayList<DOMStructure>();
              xmlObjQualifyingProperty.add(qualifPropStruct);
              XMLObject objectSingedInfo = factory.newXMLObject(xmlObjSignedInfo,
                        null, null, null);
              XMLObject objectQualifyingProperty = factory.newXMLObject(
                        xmlObjQualifyingProperty, null, null, null);
              // Create the ds:object tags
              List<XMLObject> objects = new ArrayList<XMLObject>();
              objects.add(objectSingedInfo);
              objects.add(objectQualifyingProperty);
              XMLSignature signature = factory.newXMLSignature(signedInfo, keyInfo,
                        objects, "cXMLSignature", null);
              DOMSignContext signContext = new DOMSignContext(keyPair.getPrivate(),
                        cxmlElement);
              signContext.putNamespacePrefix(XMLSignature.XMLNS, "ds");
              try {
                   signature.sign(signContext);
              } catch (MarshalException e) {
                   throw new RuntimeException(e);
              } catch (XMLSignatureException e) {
                   throw new RuntimeException(e);
         private Element createElement(Element element, String tag, String prefix,
                   String nsURI) {
              String qName = prefix == null ? tag : prefix + ":" + tag;
              return element.getOwnerDocument().createElementNS(nsURI, qName);
         X509Certificate getSigningCert() {
              return signingCert;
         private static String readFileAsString(String filePath)     throws java.io.IOException
              byte[] buffer = new byte[(int) new File(filePath).length()];
              BufferedInputStream f = null;
              try {
                   f = new BufferedInputStream(new FileInputStream(filePath));
                   f.read(buffer);
              } finally {
                   if (f != null) {
                        try {
                             f.close();
                        } catch (IOException ignored) {
              return new String(buffer);
         public static void main(String args[])
              System.out.println("start");
              CXMLDigitalSig cXMLDigitalSig = new CXMLDigitalSig();
              try
                   cXMLDigitalSig.loadCert();
                      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                      dbf.setNamespaceAware(true);
                   String cXML = readFileAsString("C:\\cxmlsign\\cxml.xml");
                      Document cxmlDocument = dbf.newDocumentBuilder()
                                                 .parse(new ByteArrayInputStream(cXML
                                                           .getBytes("UTF-8")));
                   System.out.println(cxmlDocument.getDocumentElement().getTagName());
                      cXMLDigitalSig.sign(cxmlDocument.getDocumentElement(), "55");
              catch(Exception e)
                   //System.out.println(e.getMessage());
                   System.out.println(getStackTrace(e));
                 System.out.println("end");
           public static String getStackTrace(Throwable aThrowable) {
                  final Writer result = new StringWriter();
                  final PrintWriter printWriter = new PrintWriter(result);
                  aThrowable.printStackTrace(printWriter);
                  return result.toString();
    }Edited by: sabre150 on Jan 18, 2012 1:57 PM
    Moderator action : added [ code ] tags to format source code

  • Can't digitally sign and encrypt email any longer.

    I used to sign and encrypt my emails digitally and then send them to people. I had two email certificates from Comodo, and it's been a while they're expired. so I renewed my certificates and deleted the old ones from my keychain, then downloaded and added the new ones. The trouble is I no longer get the digitally sign the message and encrypt the message button when I compose a new email. What could be the problem? how can I fix this?

    I am now having the same problem.  Have you seen a resolution yet?

  • Can't Digitally Sign Excel 2013

    So,
    I imported an old 2003 xls file and have made modifications to the resulting xlsm, including updating commands to custom ribbon tab, etc.
    I have long had my own Root Certificate and Publisher Certificate for my development jobs, (and other .net applications) and previously had signed the xls file with the publisher certificate. That did not import through to the 2013 xlsm.
    So, after my updates I'm ready to finalize the project, and I go to the VBA Editor, Tools | Digital Signature.
    I get the dialog, it says [no certificate] for both, so I click "Choose".
    I get: No usable signing certificates are available. Please insert your smart card, or contact your administrator to obtain a signing certificate.
    It wouldn't let me browse to a PFX or CER file on my hard drive, it just dies. It won't let me select of find my certificate with which to digitally sign my project.
    Thanks
    Jaeden "Sifo Dyas" al'Raec Ruiner
    PS - Should be noted this is on a Windows 8.1 Home machine.
    "Never Trust a computer. Your brain is smarter than any micro-chip."
    PS - Don't mark answers on other people's questions. There are such things as Vacations and Holidays which may reduce timely activity, and until the person asking the question can test your answer, it is not correct just because you think it is. Marking it
    correct for them often stops other people from even reading the question and possibly providing the real "correct" answer.

    Okay,
    Maybe I wasn't clear.
    I already have PFX and CER files created.  These certificates were made with MAKECERT.EXE from Microsoft SDKs.  I use them in all of my .Net Development.  I Used them in my Office 2003 development.  There should be no need to run any another
    "cert" program to apply EXISTING CERTIFICATES to an Excel or Access Project.
    If I purchased a Certificate from Verisign, would you still be saying use "Selfcert" to get the "choose" option to show a simple open file dialog?  I need to get Excel to quit being stupid and just allow me to "Choose" existing files.  Now, perhaps
    the PFX files need to be in a specific location on my hard drive for Excel/Office to recognize that the PFX or CER exist?  What does "SelfCert" do to the file/computer that would allow me to use my current PFX files without creating another one, and then
    let me just skip to that process instead of using self cert to create another certificate.
    How does Microsoft, and Verisign, and other company's apply certificates to projects and applications, cause they sure as hell don't use "SelfCert".
    Thanks
    J"SD"a'RR
    "Never Trust a computer. Your brain is smarter than any micro-chip."
    PS - Don't mark answers on other people's questions. There are such things as Vacations and Holidays which may reduce timely activity, and until the person asking the question can test your answer, it is not correct just because you think it is. Marking it
    correct for them often stops other people from even reading the question and possibly providing the real "correct" answer.

  • I can't electronically sign a PDF document

    I have a PDF document (visa application) which requires an electronic signature however all the 'sign' options that are avaliable to me do not seem to work. When clicking on the 'Sign' option to the right side of the document all the options in the drop-down menu remain greyed out meaning I cannot use them. I have checked the security details of the document and 'signing' is allowed. I'm currently using Adobe reader XI. I've never used this before and have exhausted all means of trying to solve the problem myself so it would be greatly appreciated if someone could please help me out.

    Hi TheKrow,
    The PDF you are trying to sign might not be Rights extended, Reader is only the read only software and is not meant for editing modifying or signing the document. For making Adobe Reader to perform certain task we need to make PDF Rights Enabled. That can be done via Adobe Acrobat.
    I would recommend if you ask you to contact the creater of the PDF and ask him to send the PDF which is Reader Rights Enabled.
    ~Pranav

  • How can i digital sign a file using JAVA?

    and how can i verify the digitially signed file was not altered by anyone using JAVA?
    please provide me with the simpliest way to do this.
    thanks a lot.

    I have no idea but you might want to take a look at :
    http://java.sun.com/j2se/1.5.0/docs/guide/security/index.html
    hth

  • Can't digitally sign using CAC on XI

    Any advice?

    Hard to say without seeing what you are seeing. Are you using a digital signature or an ink signature. What OS? What version of Acrobat?

  • Why can't I sign a document?

    I have adobe reader v 11.0.04 and for some reason everytime I import a document (PDF) and click on the sign tab to try and place a signature, everything in the sign tabis all grayed out. Please help.
    OS: 10.9 ( wouldn't work on 10.8 either)
    The problem seemed to happen after upgrading to v 11.0.04

    That depends on the document, though some people are also reporting problems with the lastest Reader update. If the document is secured ij a way that would preclude adding e-signatures, you won't be able to add them. If you're wanting to digitally sign, then the document needs to be specifically enabled for this, either by Acrobat Pro or LiveCycle Reader Extensions. THis is something the creator of the document must do before distributing it.

  • Getting Error:Digitally Signing documents using Acrobat SDK

    I am using following API's to digitally sign a document using Acrobat SDK but getting error(return code -2) while making a call to folllowing API DigSigCommitSigRefDict(ASAtomFromString("DocMDP"), tempDict, &pOutRefDict);
    What am i missing?
    Here's my code.
        CosObj sigDict = CosNewDict(cosDoc, true, 1L);                         //Signature Dictionary Cos Object
        CosObj  sigRefDict= CosNewDict(cosDoc, true, 1L);                    //Signature Reference Dictionary Cos Object
        CosDictPut(sigRefDict, ASAtomFromString("TransformMethod"), CosNewName(cosDoc, false, ASAtomFromString("DocMDP")));
        CosDictPut(sigRefDict, ASAtomFromString("Type"), CosNewName(cosDoc, false, ASAtomFromString("SigRef")));
        refArrayObj = CosNewArray(cosDoc, false, 1L);                         //Reference array object inside signature dictionary
        CosArrayInsert(refArrayObj,1, sigRefDict);
        CosDictPut(sigDict, ASAtomFromString("Reference"), refArrayObj);
        CosDictPut(sigDict, ASAtomFromString("Type"), CosNewName(cosDoc, false, ASAtomFromString("Sig")));  
        CosDictPut(sigField, ASAtomFromString("V"), sigDict);               //SigField is an AcroForm object
        DSSigRefDictParamsRec myDSSigRefDictParams;
        myDSSigRefDictParams.size = sizeof(DSSigRefDictParamsRec);
        myDSSigRefDictParams.cosDoc  = PDDocGetCosDoc(pdDoc);
        myDSSigRefDictParams.rootObj   = cRoot;
        myDSSigRefDictParams.sigDict   = sigDict ;
        myDSSigRefDictParams.transformMethod   = ASAtomFromString("DocMDP");
        //myDSSigRefDictParams->transformParams   =
        myDSSigRefDictParams.bIndirect    = true;
        DSSigRefDictErrParams errParams;
        DSRetCode retCode = DigSigNewSigRefDict(&myDSSigRefDictParams,errParams);
        CosObj pOutRefDict;
        retCode = DigSigCommitSigRefDict(ASAtomFromString("DocMDP"),sigDict , &pOutRefDict);
        retCode = DigSigFinishSigRefDict(ASAtomFromString("DocMDP"), sigDict , pOutRefDict,errParams);
    -amit

    Thanks for the tip George. I'm using Acrobat Pro X to create a form. Can you tell me how to make the form reader-enabled so that it can be digitally signed?
    Josh

  • How to digitally sign PDF document in VB?

    Hi,
    I was wondering if there was a way to open a PDF file and digitally sign the document (with the electronic signature info showing on the bottom of the last page) programatically?
    Thanks
    K

    > (1) When I download the SDK, it only has a setup file which I launch - I don't see any documentation in there and no menu item is created.
    Where did you download the SDK?
    > (2) When I go to the livedocs.abobe.com link and look how to use Javascript to digitally sign documents, the link is blank and is waiting for someone to post a comment.
    May be a problem of your browser.
    > Does someone know of a VB code that allows you to digitally sign the PDF documents via Javascript?
    Look at the JavaScript sample AddSignature in the SDK.

Maybe you are looking for