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

Similar Messages

  • Adobe Acrobate XI and SecCommerce SecSigner have a problem during signing of a document, creating/verification of the signature is not possible - solutions?

    Adobe Acrobate XI and SecCommerce SecSigner have a problem during signing of a document, creating/verification of the signature is not possible - solutions? SecSigner is not responding.

    Well, I contacted SecCommerce about the issue, the response was, that I should sign the file later (afterwards). This is a solution, but not the best in my opinion.
    When I sign the document the SecSigner window/Java window appears and freezes. Adobe is not responding. I have to terminate Adobe because the program is not responding.
    I only found this support website, so I have realized that this is a User 2 User site, but it was a try to get some help.

  • Cannot resolve elements 11 problems so must restart. Also must un start program. How to start?

    Cannot resolve elements 11 problems so must restart. Also must un start program. How to start?

    Are these the tool option problems in your other discussion? If so what happened after Resetting the tools? If that didn't help, try selecting Edit> Preferences> General> Reset Preferences on Next Launch and restart PSE.
    What do you mean by 'How to start'? Are you asking how to uninstall? If on Windows there will be an uninstaller in the Control  Panel Add / Remove Programs section.
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • 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.

  • Architectural Difference Effect on Signing/Verifying XML Document

    Hi all,
    I am using Apache Santuario for signing XML.
    1. I have a Windows Server 2008 64 Bit, which is using JAVA 7 32 bit JVM. Let's say my signed document is Signed_A. On Windows Server 2008 I am signing the document but the verification fails for Signed_A.
    2. Same application is being run on Windows 7 32 bit with the same JVM version. And the document is Signed_B on this machine. I am signing the document and verifying it without a problem.
    3. If I move the document Signed_B (which I could sign & verify on Windows 7) to Windows 2008 Server, using the same application I can verify the document. So, my spider senses tell me that, there is a problem with signing.
    4. Again if I move the document Signed_A to Windows 7 machine, I could not verify the signature.
    I don't know whether the situation is occur because of the difference of processors on machines. But if you have anything that can help me please let me know. Anything could be helpful for now because I'm stuck in here.
    Please feel free to ask if you need further explanations. I am not providing any code, because I am suspecting a configuration issue here.
    Thanks in advance.

    Hi,
    Can you tell me about your project on short notes. For information.
    Regards
    R.Rajendran

  • Problem with encoding of xml document

    while parsing an xml document with SAX parser, i found that encoding of the xml document received as input stream is "ISO-8859-1" . After parsing certain fields has to be stored in the mysql table where table character set is "utf8" . Now what i found that ceratin characters in the original XML document are stored as question mark (?) in the database.
    1. I am using mysql 4.1.7 with system variable character_set_database as "utf8". So all my tables have charset as "utf8".
    2. I am parsing some xml file as inputsream using SAX parser api (org.apache.xerces.parsers.SAXParser ) with encoding "iso-8859-1". After parsing certain fields have to be stored in mysql database.
    3. Some XML files contain a "iso-8859-1" character with character code 146 which appears like apostrophes but actually it is : - � and the problem is that words like can�t are shown as can?t by database.
    4. I notiicied that parsing is going on well and character code is 146 while parsing. But when i reterive it from the database using jdbc it shows character code as 63.
    5. I am using jdbc to prepared statement to insert parsed xml in the database. It seems that while inserting some problem occurs what is this i don't know.
    6. I tried to convert iso-8859-1 to utf-8 before storing into database, by using
    utfString = new String(isoString.getBytes("ISO-8859-1"),"UTF-8");
    But still when i retreive it from the databse it shows caharcter code as 63.
    7. I also tried to retrieve it using , description = new String(rs.getBytes(1),"UTF-8");
    But it also shows that description contains character with code 63 instead of 146 and it is also showing can�t as can?t
    help me out where is the problem in parsing or while storing and retreiving from database. Sorry for any spelling mistakes if any.

    duggal.ashish wrote:
    3. Some XML files contain a "iso-8859-1" character with character code 146 which appears like apostrophes but actually it is : - &#146; and the problem is that words like can&#146;t are shown as can?t by database.http://en.wikipedia.org/wiki/ISO8859-1
    Scroll down in that page and you'll see that the character code 146 -- which would be 92 in hexadecimal -- is in the "unused" area of ISO8859-1. I don't know where you got the idea that it represents some kind of apostrophe-like character but it doesn't.
    Edit: Actually, I do know where you got that idea. You got it from Windows-1252:
    http://en.wikipedia.org/wiki/Windows-1252
    Not the same charset at all.

  • 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.

  • Problem exporting mixdown audio XML document from Soundtrack to Final Cut P

    I am writing this up at the suggestion of FCP Tech Support.
    I treated a multiclip audio track I had sent (along with the video) from FCP using the Compressor (Effects Tab>Dynamics>Compressor). I then sent the mixdown back to FCP automatically (following the instructions on page 209, Vol III, FCP User Manual.pdf). In FCP I got an error message: “ERROR: Critical Error aborted the processing an XML document…”
    I noticed, however, that the sequence with the mixdown audio was listed in the Browser. Opening it in the Time Line, the mixdown audio was there along with the muted original audio tracks; however, the video track appeared with all of its cuts, but white and unrendered. So I copied the video from the original sequence and pasted it in the new sequence, in effect replacing the problematic video track. It played back fine. I saved and closed the project, quit FCP and shut down my computer.
    When I reopened the project later on, I got a General Error 34 message. I called TS to find out what it means. After creating a new project and reopening it and another current project, neither of which displayed a General Error 34, the problem seemed to be unique to that particular project.
    FYI that project was a multiclip one with 4 camera angles. The audio from one of the camera angles was used through out, except for one clip when the audio of another angle was temporarily used. The project was shot on Mini-DV using 2 Panasonic HVX-200’s and two consumer DV camcorders.

    Thank you for anyone who read my question. I found the results on another posting. The posting was titled, "Export results in silent audio file."
    Thank you,
    Brian

  • 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.

  • Replacing special characters from xml document/text inside element

    Hi
    Is there any way to replace the xml codes to special characters inside an entire xml document/ for a text in element.
    I want to get the xml codes to get replaced to respective special character(for any special character)
    Please see the sample xml xml element below
    <Details>Advance is applicable only for &lt; 1000. This is mentioned in Seller&apos;s document</Details>
    Thanks in advance .. any help will be highly appreciated.

    So, just to be sure I understand correctly, you want this :
    <Details>Advance is applicable only for &lt; 1000. This is mentioned in Seller&apos;s document</Details>
    to be converted to :
    <Details>Advance is applicable only for < 1000. This is mentioned in Seller's document</Details>
    If so, I'll say again : the resulting XML document will be invalid.
    Extensible Markup Language (XML) 1.0 (Fifth Edition)
    The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings " &amp; " and " &lt; " respectively. The right angle bracket (>) may be represented using the string " &gt; ", and MUST, for compatibility, be escaped using either " &gt; " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end of a CDATA section.
    Ask whoever "they" are why they would want to work with not wellformed XML.

  • Parsing XML document with nested elements into multiple db tables(master-detail)

    Can you help me with storing xml document into master-detail tables?
    I have two tables:
    1) customers (customerid number primary key, firstname varchar2(30),lastname varchar2(30))
    2) cust_addresses (customerid number references customers, street varchar2(30),city varchar2(30),state varchar2(10),zip varchar2(10))
    I have XML document:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW num="1">
    <CUSTOMERID>1044</CUSTOMERID>
    <FIRSTNAME>Paul</FIRSTNAME>
    <LASTNAME>Astoria</LASTNAME>
    <HOMEADDRESS>
    <STREET>123 Cherry Lane</STREET>
    <CITY>SF</CITY>
    <STATE>CA</STATE>
    <ZIP>94132</ZIP>
    </HOMEADDRESS>
    <HOMEADDRESS>
    <STREET>N.Fryda 4</STREET>
    <CITY>CB</CITY>
    <STATE>CZ</STATE>
    <ZIP>37005</ZIP>
    </HOMEADDRESS>
    </ROW>
    </ROWSET>
    I know that I must use DBSM_XMLSave package, create view and instead of trigger but I did found no example in documentation.
    Thanx.

    Interested question; one I do not know the answer to at the moment, I am afraid. I would like to know your results.
    To tell others, though, what I have done. I did finally adapt Muench's not-yet-published examples #71 to work with a table. Here the table has as it's value "#{backing_app_EPG_DAYPG.jobDayDriverTable[row.Id1]}"
    This accesses a hash map defined in the backing bean as follows:
    public Map jobDayDriverTable = new HashMap(){
    @Override
    public Object get(Object key) {
    Number jobDayId = (Number)key;
    if (getEpgDayPage().jobDayDrivers(jobDayId) != null) {
    return getEpgDayPage().jobDayDrivers(jobDayId).getAllRowsInRange();
    else return null;
    jobDayDrivers returns RowIterator. From this I call getAllRowsInRange which returns a Row[]. The table consumes this as a value, and lists the values as I want.
    Since the table is using Rows for its rows, I am guessing that it would have access to #{row.rowKeyStr}, or at least #{row.<pk>} which would allow you to programmatically set the current row using code like the following:
    public static boolean setCurrentRow() {
    // BindingContainer bindings = getBindings();
    OperationBinding operationBinding =
    // bindings.getOperationBinding("setCurrentRowWithKey");
    (OperationBinding)EL.get("#{bindings.setCurrentRowWithKey}");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return false;
    return true;
    You could call this as part of code in a pages backing bean behind a button or link.
    Hope this helps somebody.
    By the way example #71 was to get a detail set of rows from a master row value and display the detail set in the master row of an af:table.
    You can find this and other examples at http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html

  • Problem in parsing huge XML document

    Hi,
    i am getting the problem when trying to parse xml doc. which contains data more then 1 lacs. using jaxp (i.e. NodeList). i get the execption outofmemory.

    Which implementation of JAXP are you using? If it is a large file containing many of the same "documents", then consider using SAX as it is an event driven parser meaning it does not have to read the whole of the file before it can start processing it. Instead, it fires events when it sees the beginning and end of a "document" and also on completion of the elements. You can then create and destroy objects during the document processing stage which helps keep the memory consumption under control.

  • Problem validating XMl document

    Hi everyone,
    I'm facing a problem validating a XML document with Apache toolkit under windows XP and eclipse 3.0
    I generate a pair of public/private keys using the RSA algorithm. The keys are of arbitrary length, but satisfying RSA conditions, ie we can encrypt and decrypt.
    I can sign my XML document, but no way to validate it. Validation is only ok when I generate random keys using the KeyPairGenerator.
    Do you think that arbitrary length keys don't allow to validate XML document. And do you have any idea how to solve the problem ( I'm not allowed to generate fixed length keys) ?
    Thansk a lot for your precious help.

    solved!
    urghh...forgot to load th eschema..duh. (must be friday)
    here's the fixed code:
        // parse the xml document (validate the xml string using a schema  file)
        // the xml document does not specified the System ID or location of
        // schema..and use no namespace
        public void parse(HandlerType type, String xmldoc) throws SAXException, IOException {
            File           schema      = schemaMap.get(type);
            DefaultHandler handler     = handlerMap.get(yype);
            XMLReader   reader = XMLReaderFactory.createXMLReader(VENDOR);
            InputSource source = new InputSource(new StringReader(xmldoc));
            reader.setContentHandler(handler);
            reader.setFeature("http://xml.org/sax/features/validation", true);
            reader.setFeature("http://apache.org/xml/features/validation/schema", true);
            reader.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
            reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
            "file:///" + schema.getAbsolutePath());
            reader.parse(source);          
        }

  • Transforming signed XML document with namespace invalidates signature

    I am running into a problem signing an XML document. Well, signing the document isn't the problem, as I can sign it and then verify the signature with the public key successfully. The problem comes when I transform the document to a string. It all appears to be OK, but when I transform it back, the hash no longer verifies. After more testing, it appears that the issue is related to namespaces. When I remove namespaces from the document, the signing and transformations work just fine. Does anyone have any insight on this?
    Here is how I am transforming the document to an XML string that I and back.
        try
          signSAML( doc, assertionElement );
          xmlSource = new DOMSource( doc );
          baos = new ByteArrayOutputStream();
          outputTarget = new StreamResult( baos );
          xmlString  = new String( new ByteArrayInputStream( baos.toByteArray() ) );
          transformerFactory = TransformerFactory.newInstance();
          transformer = transformerFactory.newTransformer();
          transformer.transform( xmlSource, outputTarget ); 
          boolean verified = verify( doc );
          if ( verified )
            System.out.println( "Verified" );
          else
            System.out.println( "UNVerified" );
        catch ( Exception e )
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

    jtahlborn wrote:
    i'm not talking about the transform, i'm talking about this line:
    xmlString  = new String( new ByteArrayInputStream( baos.toByteArray() ) );which is a great way to break xml data.Yes. That's not the only kind of data it's good at breaking, either.
    To the OP: just have your transform output to a StringWriter in the first place. Don't muck about converting between chars and bytes unless you know the correct encoding and use it. Which you don't know it and you didn't use it.

  • 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