Problem in digitally signing a particular element of an XML Document

hi all!!
I was trying to sign a particular element of an XML document using JSR105 (XML Digital Signatures) API.
For which i used +#xpointer(id('idvalue'))+ and +#idvalue+ as the URI for the reference i create as below :
Reference ref = fac.newReference("#xpointer(id('123')) ", fac.newDigestMethod(DigestMethod.SHA1, null), Collections.singletonList(fac.newTransform(Transform.ENVELOPED,(TransformParameterSpec) null)), null, null);
NOTE: Here 123 is the value of the attribute 'id' of the element i wish to sign in the input XML document.
But when i try to digest and sign the the above created reference, i get the following exception (which is strange! atleast for me!)
Exception in thread "main" javax.xml.crypto.dsig.XMLSignatureException: javax.xml.crypto.URIReferenceException: Can't resolve ID: '123' in ''
at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.calculateDigestValue(ReferenceImpl.java:327)
at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.sign(ReferenceImpl.java:237)
at com.ibm.xml.crypto.dsig.dom.XMLSignatureImpl.sign(XMLSignatureImpl.java:158)
at sent.Generate.main(Generate.java:103)
Caused by: javax.xml.crypto.URIReferenceException: Can't resolve ID: '123' in ''
at com.ibm.xml.crypto.dsig.dom.URIDereferencerImpl.dereference(URIDereferencerImpl.java:193)
at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.calculateDigestValue(ReferenceImpl.java:285)
+... 3 more+
javax.xml.crypto.URIReferenceException: Can't resolve ID: '123' in ''
at com.ibm.xml.crypto.dsig.dom.URIDereferencerImpl.dereference(URIDereferencerImpl.java:193)
at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.calculateDigestValue(ReferenceImpl.java:285)
at com.ibm.xml.crypto.dsig.dom.ReferenceImpl.sign(ReferenceImpl.java:237)
at com.ibm.xml.crypto.dsig.dom.XMLSignatureImpl.sign(XMLSignatureImpl.java:158)
at sent.Generate.main(Generate.java:103)
I've given the whole Java code i used to generate the signature and the XML i used below for you to get a clear picture of what i tried...
Any suggestions are very much welcome..
thanks..
ragu
Generate.java
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.xml.crypto.MarshalException;
import javax.xml.crypto.dsig.CanonicalizationMethod;
import javax.xml.crypto.dsig.DigestMethod;
import javax.xml.crypto.dsig.Reference;
import javax.xml.crypto.dsig.SignatureMethod;
import javax.xml.crypto.dsig.SignedInfo;
import javax.xml.crypto.dsig.Transform;
import javax.xml.crypto.dsig.XMLSignature;
import javax.xml.crypto.dsig.XMLSignatureException;
import javax.xml.crypto.dsig.XMLSignatureFactory;
import javax.xml.crypto.dsig.dom.DOMSignContext;
import javax.xml.crypto.dsig.keyinfo.KeyInfo;
import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
import javax.xml.crypto.dsig.keyinfo.KeyValue;
import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
import javax.xml.crypto.dsig.spec.TransformParameterSpec;
import javax.xml.crypto.dsig.spec.XPathFilterParameterSpec;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
public class Generate {
      * @param args
      * @throws NoSuchAlgorithmException
      * @throws InvalidAlgorithmParameterException
      * @throws KeyException
      * @throws ParserConfigurationException
      * @throws IOException
      * @throws SAXException
      * @throws FileNotFoundException
      * @throws XMLSignatureException
      * @throws MarshalException
      * @throws TransformerException
     public static void main(String[] args) throws NoSuchAlgorithmException,
               InvalidAlgorithmParameterException, KeyException,
               FileNotFoundException, SAXException, IOException,
               ParserConfigurationException, MarshalException,
               XMLSignatureException, TransformerException {
          java.security.Security
                    .addProvider(new com.ibm.xml.crypto.IBMXMLCryptoProvider());
          XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM",
                    new com.ibm.xml.crypto.IBMXMLCryptoProvider());
          //reference generation
          //its here where I point the URI to the element i want to digest
          Reference ref = fac.newReference("#xpointer(id('123'))", fac.newDigestMethod(DigestMethod.SHA1, null), Collections.singletonList(fac.newTransform(Transform.ENVELOPED,(TransformParameterSpec) null)), null, null);
          //signedinfo element generation
          SignedInfo si = fac
                    .newSignedInfo(fac.newCanonicalizationMethod(
                              CanonicalizationMethod.INCLUSIVE,
                              (C14NMethodParameterSpec) null), fac
                              .newSignatureMethod(SignatureMethod.RSA_SHA1, null),
                              Collections.singletonList(ref));
          KeyInfoFactory kif = fac.getKeyInfoFactory();
          //Create a DSA KeyPair
          KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
          kpg.initialize(512);
          KeyPair kp = kpg.generateKeyPair();
          KeyValue kv = kif.newKeyValue(kp.getPublic());
          // Create a KeyInfo and add the KeyValue to it
          KeyInfo ki = kif.newKeyInfo(Collections.singletonList(kv));
          // Instantiate the document to be signed
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
          dbf.setNamespaceAware(true);
          Document doc = dbf.newDocumentBuilder().parse(
                    new FileInputStream(new File("shippedPedigree.xml")));
          // Create a DOMSignContext and specify the DSA PrivateKey and
          // location of the resulting XMLSignature's parent element
          DOMSignContext dsc = new DOMSignContext(kp.getPrivate(), doc
                    .getDocumentElement());
          //Create the XMLSignature (but don't sign it yet)
          XMLSignature signature = fac.newXMLSignature(si, ki);
          // Marshal, generate (and sign) the enveloped signature
          signature.sign(dsc);
          //writing the signed document back to the file
          OutputStream os;
          os = new FileOutputStream(new File("shippedpedigree.xml"));
          TransformerFactory tf = TransformerFactory.newInstance();
          Transformer trans = tf.newTransformer();
          trans.transform(new DOMSource(doc), new StreamResult(os));
the "shippedPedigree.xml" i used to sign:
<?xml version="1.0" encoding="UTF-8"?>
<ped:pedigree xmlns:ped="urn:epcGlobal:Pedigree:xsd:1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ped:shippedPedigree id="123">
<ped:documentInfo>
<ped:serialNumber>2233</ped:serialNumber>
<ped:version>ped:version</ped:version>
</ped:documentInfo>
<ped:signatureInfo>
<ped:signerInfo>
<ped:name>Joe Doe</ped:name>
<ped:title>Manager</ped:title>
<ped:telephone>800-521-6010</ped:telephone>
<ped:email>[email protected]</ped:email>
<ped:url>www.kittinginc.com</ped:url>
</ped:signerInfo>
<ped:signatureDate>2001-12-31T12:00:00</ped:signatureDate>
<ped:signatureMeaning>Certified</ped:signatureMeaning>
</ped:signatureInfo>
<ped:itemInfo>
     <ped:lot>123</ped:lot></ped:itemInfo>
</ped:shippedPedigree></ped:pedigree>
------------------------------------------------------------------------

Sabarisri N wrote:
Hi All,
my xml is like below.
<ns1:abcd>
<ns2:a>1</ns2:a>
<ns2:b>2</ns2:b>
</ns1:abcd>
If i try retrieving the value of the root element of this xml document,
Node myroot=doc.getDocumentElement();
String result=myroot.getNodeName();
My output is ns1:abcd .. i want only "abcd"...
The parser is returning the correct rootNodeName i.e ns1:abcd. rootNodeName always goes with the given input and returns the root element as is.
>
My xml will not always have same namespaces.. from the incoming xml i should first check, for the namespaces..Please give me some idea.
I guess.. I need some namespace evaluation to be set..
Refer below link it'll give idea of identifying XML-NAMESPACE-PREFIX
http://java.sun.com/developer/Books/xmljava/ch03.pdf
http://download.oracle.com/javaee/1.4/tutorial/doc/JAXPSAX9.html
Please help me in this regard.
Thanks,
Sabarisri. N

Similar Messages

  • Inserting an element into an XML document

    I am simply looking insert a new element into an existing XML Document using JDOM. Here is my code so far:
    public class UserDocumentWriter {
         private SAXBuilder builder;
         private Document document;
         private File file = new File("/path/to/file/users.xml");
         private Element rootElement;
         public UserDocumentWriter() {
              builder = new SAXBuilder();
              try {
                   document = builder.build(file);
                   rootElement = document.getRootElement();
              } catch (IOException ioe) {
                   System.err.println("ERROR: Could not build the XML file.");
              } catch (JDOMException jde) {
                   System.err.println("ERROR: " + file.toString() + " is not well-formed.");
         public void addContact(String address, String contact) {
              List contactList = null;
              Element contactListElement;
              Element newContactElement = new Element("contact");
              newContactElement.setText(contact);
              List rootsChildren = rootElement.getChildren();
              Iterator iterator = rootsChildren.iterator();
              while (iterator.hasNext()) {
                   Element e = (Element) iterator.next();
                   if (e.getAttributeValue("address").equals(address)) {
                        contactListElement = e.getChild("contactlist");
                        contactListElement.addContent(newContactElement);
                        writeDocument(document);
         public void writeDocument(Document doc) {
              try {
                   XMLOutputter output = new XMLOutputter();
                   OutputStream out = new FileOutputStream(file);
                   output.output(doc, out);
              } catch (FileNotFoundException ntfe) {
                   System.err.println("ERROR: Output file not found.");
              } catch (IOException ioe) {
                   System.err.println("Could not output document changes.");
         }However, the problem is, the newly added element will always be appended to the end of the last line, resulting in the following:
    <contactlist>
                <contact>[email protected]</contact><contact>[email protected]</contact></contactlist>Is there anyway in which I can have the newly added element create it's own line for the purpose of tidy XML? Alternatively is there a better methodology to do the above entirely?

    Your question is not very clear.
    Do you want to know How to insert an element into an XML document?
    Answer: I can see you already know how to do it. You have added the element using addContent()
    or do you want to know How to display the XML in a tidy format?
    Answer: to view the XML in a properly formatted style you can you the Format class. A very basic way of viewing the XML would be:
       * Prints the Document to the specified file.
       * @param doc
       * @param filename
       * @param formatting
      public static void printDocToFile(Document doc, String strFileName,
          boolean formatting)
        XMLOutputter xmlOut = null;
        if (!formatting)
          xmlOut = new XMLOutputter();
        } else
          Format prettyFormat = Format.getPrettyFormat();
          prettyFormat.setOmitEncoding(false);
          prettyFormat.setOmitDeclaration(false);
          xmlOut = new XMLOutputter(prettyFormat);
        try
          if (doc != null)
            FileWriter writer = new java.io.FileWriter(strFileName, true);
            xmlOut.output(doc, writer);
            writer.flush();
            writer.close();
          } else
            System.out.println("Document is null.");
        catch (Exception ex)
          System.out.println(ex);
      }

  • How to Add namespace to all elements in a xml document

    Hi,
    I am trying to read an xml file that does not have any namespace definitions. I have been able to create another schema in which i specify the namespace defination as shown below.
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://TargetNamespace.com/AckPaymentFile_PL" targetNamespace="http://TargetNamespace.com/AckPaymentFile_PL" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" nxsd:version="DTD" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <include schemaLocation="PM_XML_FILE_ACK_SCHEMA_NO_NAMESPACE.xsd"/>
    </xs:schema>
    Once i do it, i am able to see the namespace has been assigned to the root element. I am looking for a way to assign the namespace and prefix tag to all elements in the xml document. If i don't i am unable to access any part of the xml document, keep getting please verify if xpath is correct.
    Thanks
    Sridhar

    Hello,
    Once you've answered all the above.
    If you can run xpath that supports functions against the xml, the expression:
    count(//phone)Otherwise, without leaving SQL:
    select count(*) from
    xmltable('//phone' passing
      -- Your XML goes here, could be a table column with type XMLTYPE.
      xmltype('<person><phone>123-456-7890</phone><phone>098-765-4321</phone></person>')
      columns phone varchar2(24 char) path '/phone'
    ;

  • Identify individual elements in repeated elements in an XML document

    Hello,
    I'd like to identify individual elements in repeated elements in an XML document.
    For example a table 'dataXML' which has a column 'sample' (XMLType). If I have an XML document such as,
    <ELEMENT>
    <PO>
    <PONO>100</PONO>
    <PONO>200</PONO>
    </PO>
    </ELEMENT>
    I can use //PONO[1] to identify the first "PONO" element (with value 100) and //PONO[2] to identify the second "PONO" element in the document.
    If I write this query:
    select L.sample.extract('ELEMENT/PO/PONO/text()')).getStringVal()"SAMP"
    from dataXML L
    I'll receive this result:
    SAMP
    100200 (the first row)
    And if I write this query:
    select L.sample.extract('ELEMENT/PO/PONO[1]/text()')).getStringVal()"SAMP"
    from dataXML L
    I'll receive this result:
    SAMP
    100 (the first row)
    But I'd like the following result:
    SAMP
    100 (the first row)
    200 (the second row).
    Could you help me, please?
    Thank you very much.
    Melissa Lemos

    you have to use something like this.
    select extractvalue(xmltype_column, '/Name/@attributename')
    from table_name
    For more details see
    XMLDB Developers Guide (Oracle 9i)
    Chapter - XPATH and namespace Primer
    Table C2 - Location Path Examples Using Abbreviated Syntax.
    Page Number 907/1044
    Hope this helps.

  • How to Find Number of Given Element in a XML Document

    Hello Experts,
    I want to know the number of given element in a XML document. For example if we have an employees information as a XML document, can we have how many <phone> element in the XML document?
    Thanks in advance.
    Regards,
    JP

    Hello,
    Once you've answered all the above.
    If you can run xpath that supports functions against the xml, the expression:
    count(//phone)Otherwise, without leaving SQL:
    select count(*) from
    xmltable('//phone' passing
      -- Your XML goes here, could be a table column with type XMLTYPE.
      xmltype('<person><phone>123-456-7890</phone><phone>098-765-4321</phone></person>')
      columns phone varchar2(24 char) path '/phone'
    ;

  • Use DOM to get the element value of XML document?

    I can not to use the method getNodeValue to get the element value of XML document. How can I do for it?
    For example, for element
    <address>125 Smith Avenue</address>
    how to get the value "125 Smith Avenue" by using DOM?
    Thanks

    Thanks for all of you.
    The code indicates that I need to get the node by tag name. If I do not know the distribution of the elements and want to traverse all nodes. If the node contains value, I retrieve the value. How to implement the general case.
    For example, my XML file represent a directory hierarchy and looks like
    <root>
    <usr>
    <user>user1
    <file>file1</file>
    <file>file2</file>
    </user>
    <user>user2
    <file>file1</file>
    <file>file2</file>
    <file>file3</file>
    <file>file4</file>
    </user>
    </usr>
    </root>

  • Digitally Signing specific SOAP elements using Java Mapping

    Hello SDNers,
    Iu2019m having trouble creating java mappings to sign and verify digital signatures.  Iu2019m new to Java so this is proving difficult.  I understand the basic concepts of OO programming and utilizing classes/objects to build the program, but Iu2019m having trouble with the conceptual understanding of how I would like to get this done.
    I have outbound and inbound messages.  The outbound messages are originating from an ECC backend.  The messages are processed through PI with a basic Message Mapping, then it is wrapped in a SOAP envelope with specific information using a XSL mapping and then I would like to use a Java Mapping to Digitally Sign specific portions of the entire message; specifically around an element in the SOAP header and sign the SOAP body.  I also need to verify these sections for all inbound messages.
    The simple pseudo code I have for the outbound messages is as follows:
    <ol>
    <li>1. read in xml (file input stream)</li>
    <li>2. find the (specific information)</li>
    <ol>
    <li>a. assign that string to a variable</li>
    <li>b. sign this variable with the security profile (keystore, private key)</li>
    <li>c. e-write the variable into the main xml file</li>
    </ol>
    <li>3. find the soap body</li>
    <ol>
    <li>a. assign that string to a variable</li>
    <li>b. sign this variable with the security profile (keystore, private key)</li>
    <li>c. re-write the variable into the main xml file</li>
    </ol>
    <li>4. write the output file with both variables written (file output stream)</li>
    </ol>
    Currently Iu2019m using PI 7.1 so there is no more Visual Administrator tool.
    Iu2019ve seen the examples from the last link, but I canu2019t seem to put it together when mixed with basic java mapping example.  I have been searching the SDN forums for a while now, but hereu2019s my specific question:  how do you create a java mapping to sign and verify specific elements of a SOAP message?
    Thanks in advance,
    Jason

    Hi Jason, did you ever architect a solution for this?

  • Problems with digitally signed PDF FORM

    Hi everyone,
       I am having a situation as follows:
    I have a adobe form that is digitally signed. In Adobe 9 once it is signed, the two properties are set as -
    1)Document assembly not allowed
    2)Changing the document not allowed.
    By saving the pdf into .ps file and reopening it with Adobe pro, I was able to put some links from the text in PDF, using "LINK TOOL" button. But if I redo the links again, then comes the problem. And also, When I merge this pdf form with another the signatures are lost!!! Can anyone please help me and shed some light on this.
    Appreciate all your help.
    rgds,
    Suma.

    Hi Suma
    One thing to realize is one of the purposes of a digital signature is to provide proof of document integrity. With that in mind, although in Acrobat 8 and earlier you were allowed to make changes to the document, and thus invalidate the digital signature, beginning with version 9 we have disabled that functionality. If you need to edit the core PDF don't sign it. The signature should be applied after all of the document layout has been completed. You can fill in form fields and add comments and annotations post signing, but it makes no sense to modify the document structure when all it will do is invalidate the signature.
    Steve

  • Having problem to digitally sign onto IBM Lotus Forms Viewer3.5.1

    Hi!
    My name is Seteve, Yi who US Army Garrision Yongsan, South Korea.
    We recentely installed Adobe Acrobet Pro X with AcrobatUpd1001_Tier1 updates.
    After we did that I'm having problem to digital signature onto e-Forms.
    We use IBM Lotus Forms Viewer3.5.1 for handling e-Forms.
    When I trying to retreive certificates from my CAC card, the program looks like couldn't find certificates from my CAC card.
    I didn't have any problem with Adobe Professional 9.4.2 to put digital signature with IBM Lotus Forms Viewer3.5.1.
    We use Windows Vista Enterprise SP2 as basic OS.
    The problem is disappeared when I uninstall Adobe Acrobet Pro X or didn't install AcrobatUpd1001_Tier1 updates.
    So, it definitely related to AcrobatUpd1001_Tier1 updates.
    V/R,

    Note that running your page through the W3C Validator gives this list of errors: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.bataviabulldogfootball.tk%2F&charset=%2 8detect+automatically%29&doctype=Inline&group=0
    I see that you have a very thin doctype at the top. I suggest you create a new page in Dreamweaver and copy the bit at the top of the page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    Then put that code in place of these lines from your current page:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
    I see that you have two opening <body> tags. Delete one; it is not needed. Add the preload images from the second into the first body tag and delete the second.
    I see code below the closing </html> tag. Re position it before the closing </body> tag.
    Because of these errors mentioned above, it was impossible to see the page. Fix and reply here when you have done so.
    Also, it is not possible for me to divine what difficulty you are having. If you can please also express it in English (LOL), I'll be happy to suggest a correction for you!
    Beth
    p.s. Posting entire blocks of code is NEVER as helpful as giving us a link to the pages in action. I seldom read through code dumps here in the Forum.
    Message was edited by: Zabeth69

  • How to search for a particular element within a XML variable using studio?

    All,
    I am using studio 7.0 to develop a webbased application. In this, i need to access
    an oracle db using a WLAI Application View from my Workflow. I get some data back
    from Oracle as an XML variable and then apply an XPath statement to access the
    individual columns returned.
    My problem arises when there are no records in the db matching my criteria and
    an empty XML variable is returned to me from the app view. In these cases my
    XPath statement fails in studio causing an improper exit.
    Does anybody know how to check for content in a XML varaible using studio? So
    that if there is content i can proceed with XPath and if there is no content,
    then i will take a different route.
    Thanks in advance
    Regards
    Sri

    If I remember correctly, the adapter will return an XML document that contains
    XML elements for each row. You can just simply check the count of these elements
    with an XPath statement: ie. count(response/row)
    "Sri " <[email protected]> wrote:
    >
    All,
    I am using studio 7.0 to develop a webbased application. In this, i need
    to access
    an oracle db using a WLAI Application View from my Workflow. I get some
    data back
    from Oracle as an XML variable and then apply an XPath statement to access
    the
    individual columns returned.
    My problem arises when there are no records in the db matching my criteria
    and
    an empty XML variable is returned to me from the app view. In these
    cases my
    XPath statement fails in studio causing an improper exit.
    Does anybody know how to check for content in a XML varaible using studio?
    So
    that if there is content i can proceed with XPath and if there is no
    content,
    then i will take a different route.
    Thanks in advance
    Regards
    Sri

  • Creating an Element for an XML Document

    Assuming I have an XML file
    file.xml
    <root>
    <child1>
    <child2>
    <child100>
    <root>
    i do
    SAXBuilder parser = new SAXBuilder();
    doc = parser.build(file);
    root = doc.getRootElement();This returns a root elemnet for the entire tree.Now my question is how do i create a root element for say jus the top 10 children? That is, is there a way i can create a document just reading the first 10 elements from the file tree above so that when i do a getChildren on root I should have only 10 elements in the list.

    | 1. How are the attributes of an XML element can be stored to the database
    XML SQL Utility (which XSQL uses under the covers) only stores
    documents in the canonical format. You'll need to use an XSLT
    transformation to transform data into the canonical format
    (including transforming attribute values into elements whose
    names correspond to the column in which you'd like to store it)
    | 2. How can I store a single XML document to multiple database tables?
    I outline several techniques for this in my upcoming
    O'Reilly book, "Building Oracle XML Applications".
    The basic idea is to either:
    (1) Use an Object View with an INSTEAD OF INSERT trigger, or
    (2) Use a technique that transform the inbound document
    into a multi-table insert-format and passes each
    relevant part for insert to the XML SQL Utility separately.
    null

  • How do I retrieve elements in a xml document ?

    I would like to know how to retrieve elements from xml document ?
    I have created a document already, but how do I proceed from there ?
    Also, how do I access the values inside, the attributes and value ?
    Thank you.

    parse the xml file in node wise using compare criteria according to programmer choice u can able to retrieve the elements which u want promptly

  • Problems sending digitally signed emails.

    Hello there.
    I have installed my certificate to use S/MIME with my Gmail account on my iPhone and I turned on the option to sign all outgoing emails, but the emails aren't being recognized as signed when I send a message. If I look at the email on my Gmail sent items using Gmail's web interface, there is an attachment in the sent mail called smime.p7s but Outlook didn't recognize the email as signed (and didn't show the attachment either), and neither did my iPhone (sending a msg to myself).
    Using the same certificate, if I send a message using Outlook on my PC, it works fine.
    Anybody had the same problem / know a solution?
    Thanks,
    Felipe.

    Any client that does not support SMIME shows a .p7s file attachment.  GMail web interface is one such client that does not support SMIME.
    Penango is a cool service that adds a local firefox extension that adds SMIME support to GMail.
    http://www.penango.com/
    Outlook supports SMIME, so between iOS Mail and Outlook SMIME will recognize correctly.

  • Digitally Sign All Signature Fields in the Active Document

    I have a script which will sign a single digital signature field by the field name.
    I need to revise the script so it will sign multiple/all signature fields in the active document without having to put the field name in the script, as the field names will vary with each document.
    Can anyone please advise how to modify the script to sign all fields in the active document regardless of the field name?
    function myOtherTrustedFunction()
    app.beginPriv();
    // Get and login to security handler
    var oSigHdlr = security.getHandler( "Adobe.PPKLite" );
    oSigHdlr.login( "123","/c/Documents and Settings/name/Application Data/Adobe/Acrobat/10.0/Security/FirstNameLastName.pfx");
    // Setup Signing Properties
    var chk = this.getField("Checked");
    if (chk != null) {
    // Apply Signature and save back to original file
    var bRtn = chk.signatureSign({oSig:oSigHdlr, bUI:false, oInfo:{password:"123"}});
    app.endPriv();
    Any assistance will be most appreciated.

    Thank you for your help, the script will now count only the signature fields which have not been signed.
    I have added the second part of the script to then sign all of the blank signature fields.
    The script is only signing one of the digital signature fields instead of all of the blank signature fields.
    Can you please advise how I can modify the script to sign all of the blank signature fields?
    var count = 0;
    for (var i = 0; i < numFields; i++) {
        // Get the current field object
        f = getField(getNthFieldName(i));
        // If it's a signature field and not already signed, increment counter
        if (f.type === "signature" && !f.value) {
            count++;
    var myEngine = security.getHandler( "Adobe.PPKLite" );
    myEngine.login( "123", c/Documents and Settings/name/Application Data/Adobe/Acrobat/10.0/Security/FirstNameLastName.pfx" );
    // Sign the field
    f.signatureSign( myEngine,{password: "123"});

  • How to select specific element from a XML document using JDBC?

    Hi all,
    I have a problem with selecting specific XML element in Oracle 11g release 1 from my java application. Data are stored in object-relational storage.
    My file looks like:
    <students>
    <student id="1">
    </student>
    <student id="2">
    </student>
    <student id="3">
    </student>
    </students>
    I need to select a specific <student> element. I've already tried few ways to achieve my goal but I failed.
    SELECT extract(OBJECT_VALUE,'/students/student') FROM students - works fine, but this selects all <student> elements
    SELECT extract(OBJECT_VALUE,'/students/student[1]') FROM students - which should select first <student> element works too but it causes exception when using JDBC driver returns:
    java.sql.SQLException: Only LOB or String Storage is supported in Thin XMLType
         at oracle.xdb.XMLType.processThin(XMLType.java:2817)
         at oracle.xdb.XMLType.<init>(XMLType.java:1238)
         at oracle.xdb.XMLType.createXML(XMLType.java:698)
         at oracle.xdb.XMLType.createXML(XMLType.java:676)
         at cz.zcu.hruby.data.Select.getStudent(Select.java:45)
    SELECT to_clob(extract(OBJECT_VALUE,'/students/student[1]')) FROM students - in this case I hoped that DB would convert result to CLOB but the element is quite large (definitely more than 4000 Bytes long which I find out from forum is limit). But this exception occurs:
    java.sql.SQLException: ORA-19011: Character string buffer too small
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:953)
         at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:897)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
         at cz.zcu.hruby.data.Select.getStudent(Select.java:40)
    SELECT to_lob(extract(OBJECT_VALUE,'/students/student[1]')) FROM students - I hoped I can convert return value to a LOB value but that doesn't work for me either:
    java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected -, got -
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
         at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
         at cz.zcu.hruby.data.Select.getStudent(Select.java:40)
    This behaviour raises two questions:
    1) Why SELECT extract(OBJECT_VALUE,'/students/student') FROM students works but SELECT extract(OBJECT_VALUE,'/students/student[1]') FROM students does't ?
    2) Is there any way how I can select specific element (element XPath /students/student[@id="some value"]) and convert it to String?
    Thanks for your responses I would appreciate any suggestion
    Honza

    To be exact my <student> element is a bit complicated and looks like the one at the end of this post (sorry but it's in czech). And I need to select whole xml fragment (all opening and closing tags included) as it is shown. Maybe I used wrong solution and I should use CLOB storage. I discuss this issue here: Which solution for better perfomance?
    Thanks anyway for your response. I would be very grateful if you have any further idea
    <Student RodneCislo="8051015555">
                   <Jmeno>Petra</Jmeno>
                   <Prijmeni>Nováková</Prijmeni>
                   <RodnePrijmeni>Novotná</RodnePrijmeni>
                   <TitulPred>Bc.</TitulPred>
                   <TitulZa>MBA.</TitulZa>
                   <Adresa>
                        <Okres>3702</Okres>
                        <Obec>582786</Obec>
                        <CastObce>11908</CastObce>
                        <Ulice>Nova</Ulice>
                        <UliceCislo>4</UliceCislo>
                        <PSC>60000</PSC>
                        <Stat>203</Stat>
                   </Adresa>
                   <RodinnyStav>1</RodinnyStav>
                   <StredniSkola>000559024</StredniSkola>
                   <RokMatZkousky>2001</RokMatZkousky>
                   <PPStudent DatumVerifikace="2006-08-04">
                        <SoubeznaStudia>1</SoubeznaStudia>
                        <SoubeznaStudiaMaxDelka>2.0</SoubeznaStudiaMaxDelka>
                        <CelkovaDobaStudia>1817</CelkovaDobaStudia>
                   </PPStudent>
                   <Studia>
                        <Studium VSFakulta="14330" StudijniProgram="B1801" ZapisDoStudia="2001-07-10">
                             <DelkaStudia>5.0</DelkaStudia>
                             <NovePrijaty>N</NovePrijaty>
                             <NavazujiciStudProgram>N</NavazujiciStudProgram>
                   <PredchoziVzdelani>K</PredchoziVzdelani>
                             <PocetRocniku>5</PocetRocniku>
                             <AktualniRocnik>5</AktualniRocnik>
                             <UbytovaniVKoleji>3</UbytovaniVKoleji>
                             <UkonceniStudia Datum="2004-06-28" Zpusob="1" UdelenyTitul="Bc."/>
                             <StudiumEtapy>
                                  <StudiumEtapa PlatnostOd="2001-07-10">
                                       <ObcanstviKvalifikator>1</ObcanstviKvalifikator>
                                       <ObcanstviStat>203</ObcanstviStat>
                                       <PobytVCR>A</PobytVCR>
                                       <JazykVyuky>cze</JazykVyuky>
                                       <StudijniObory>
                                            <Obor>1801R001</Obor>
                                            <Obor>1801R005</Obor>
                                       </StudijniObory>
                                       <AprobaceOboru>
                                            <Aprobace>01</Aprobace>
                                       </AprobaceOboru>
                                       <MistoVyuky>582786</MistoVyuky>
                                       <FormaStudia>P</FormaStudia>
                                       <Financovani>1</Financovani>
                                       <PreruseniStudia>S</PreruseniStudia>
                                       <PlatnostDo>2002-04-24</PlatnostDo>
                                  </StudiumEtapa>
                                  <StudiumEtapa PlatnostOd="2002-04-24">
                                       <ObcanstviKvalifikator>1</ObcanstviKvalifikator>
                                       <ObcanstviStat>203</ObcanstviStat>
                                       <PobytVCR>A</PobytVCR>
                                       <StudijniPobyt Forma="V" Program="51" Stat="056"/>
                                       <JazykVyuky>cze</JazykVyuky>
                                       <StudijniObory>
                                            <Obor>1801R001</Obor>
                                            <Obor>1801R005</Obor>
                                       </StudijniObory>
                                       <AprobaceOboru>
                                            <Aprobace>01</Aprobace>
                                       </AprobaceOboru>
                                       <MistoVyuky>582786</MistoVyuky>
                                       <FormaStudia>P</FormaStudia>
                                       <Financovani>1</Financovani>
                                       <PreruseniStudia>S</PreruseniStudia>
                                       <PlatnostDo>2002-09-01</PlatnostDo>
                                  </StudiumEtapa>
                                  <StudiumEtapa PlatnostOd="2002-09-01">
                                       <ObcanstviKvalifikator>1</ObcanstviKvalifikator>
                                       <ObcanstviStat>203</ObcanstviStat>
                                       <PobytVCR>A</PobytVCR>
                                       <JazykVyuky>cze</JazykVyuky>
                                       <StudijniObory>
                                            <Obor>1801R001</Obor>
                                            <Obor>1801R005</Obor>
                                       </StudijniObory>
                                       <AprobaceOboru>
                                            <Aprobace>01</Aprobace>
                                       </AprobaceOboru>
                                       <MistoVyuky>582786</MistoVyuky>
                                       <FormaStudia>P</FormaStudia>
                                       <Financovani>1</Financovani>
                                       <PreruseniStudia>S</PreruseniStudia>
                                       <PlatnostDo>2004-06-28</PlatnostDo>
                                  </StudiumEtapa>
                             </StudiumEtapy>
                        </Studium>
                        <Studium VSFakulta="14330" StudijniProgram="N1802" ZapisDoStudia="2004-06-29">
                             <DelkaStudia>2.0</DelkaStudia>
                             <NovePrijaty>N</NovePrijaty>
                             <NavazujiciStudProgram>A</NavazujiciStudProgram>
                             <PredchoziVzdelani>R</PredchoziVzdelani>
                             <PocetRocniku>2</PocetRocniku>
                             <AktualniRocnik>1</AktualniRocnik>
                             <UbytovaniVKoleji>3</UbytovaniVKoleji>
                             <SocialniStipendia>
                                  <SocialniStipendium NarokOd="2006-01-01">
    <NarokDo>2006-10-30</NarokDo>
                                  </SocialniStipendium>
                             </SocialniStipendia>
                             <UkonceniStudia Datum="" Zpusob="" UdelenyTitul=""/>
                             <PPStudium DatumVerifikace="2006-07-01">
                                  <NovePrijatyVerif>N</NovePrijatyVerif>
                                  <NovePrijatyKvalif>N</NovePrijatyKvalif>
                                  <NavazujiciStudProgramVerif>A</NavazujiciStudProgramVerif>
                                  <UkonceniStudiaVerif/>
                                  <FinancovanoCR>A</FinancovanoCR>
                                  <SberId>38</SberId>
                                  <DobaStudia>
                                       <Cista>733</Cista>
                                       <VcetneNeuspechuDanehoTypu>733</VcetneNeuspechuDanehoTypu>
                                       <VcetneVsechNeuspechu>733</VcetneVsechNeuspechu>
                                  </DobaStudia>
                                  <PrestoupenoKamPosledni VSFakulta="14330" StudijniProgram="N1802" ZapisDoStudia="2004-06-29"/>
                                  <UbytovaciStipendiumKod/>
                             </PPStudium>
                             <StudiumEtapy>
                                  <StudiumEtapa PlatnostOd="2004-06-29">
                                       <ObcanstviKvalifikator>1</ObcanstviKvalifikator>
                                       <ObcanstviStat>203</ObcanstviStat>
                                       <PobytVCR>A</PobytVCR>
                                       <JazykVyuky>eng</JazykVyuky>
                                       <StudijniObory>
                                            <Obor>1801T001</Obor>
                                            <Obor>1801T025</Obor>
                                       </StudijniObory>
                                       <AprobaceOboru>
                                            <Aprobace>01</Aprobace>
                                       </AprobaceOboru>
                                       <MistoVyuky>582786</MistoVyuky>
                                       <FormaStudia>P</FormaStudia>
                                       <Financovani>1</Financovani>
                                       <PreruseniStudia>S</PreruseniStudia>
                                       <PlatnostDo/>
                                       <PPStudiumEtapa DatumVerifikace="2006-07-01">
                                            <FinancovaniVerif>1</FinancovaniVerif>
                                            <StudentRozpoctovy>O</StudentRozpoctovy>
                                            <SberId>38</SberId>
                                       </PPStudiumEtapa>
                                  </StudiumEtapa>
                             </StudiumEtapy>
                        </Studium>
                   </Studia>
              </Student>

Maybe you are looking for

  • Error while running custom app

    Hi All, The following error occurred when  custom app is executed. kindly help in solving the issue. Thanks Rakesh Raparthi

  • BC Ecommerce SOAP Error: Server did not recognize the value of HTTP Header SOAPAction

    I am trying to add a product to an ecommerce site with this soap action: Product_UpdateInsert I have followed this very brief instruction: https://jollyrogers.worldsecuresystems.com/catalystwebservice/catalystecommercewebservice. asmx?op=Product_Upda

  • WHY IS IMPORTING FROM CD SUDDENLY SO SLOW??

    When I click on the Import CD button at the bottom of the page, the titles are immediately displayed as per usual in the program and each entry is checked. But the importation used to ZOOM through whatever titles were checked. Now everything is in mo

  • Error using XSQL 10 servlet

    I am using the XSQL servlet from the xdk_nt_10_1_0_2_0_production.zip package. When I run a example I always get the following error (NoSuchMethodError) I am using the xmlparserv2.jar from the xdk\lib dir. What could be wrong? java.lang.NoSuchMethodE

  • Path is empty - how do I edit with Terminal?

    Terminal noob here. While trying to use sudo command, I'm getting a "command not found error." echo $path returns nothing so I think my path got whiped out. I tried to edit .profile (from hints found on other sites) but I can't get an editor to open