More about XML encryption

Hi, all.
I'm generating a ciphered XML file (using apache.xml libraries). I've discovered that if I encrypt and decrypt an in-memory XML document, everything works fine.
However, if I save the ciphered XML document and then I load it and try to decipher, I get the following exception:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
        at java.util.Vector.elementAt(Vector.java:435)
        at org.apache.xerces.dom.DeepNodeListImpl.item(Unknown Source)
        at org.apache.xml.security.encryption.XMLCipher$Factory.newEncryptedKey(Unknown Source)
        at org.apache.xml.security.encryption.XMLCipher.loadEncryptedKey(Unknown Source)
        at org.apache.xml.security.encryption.XMLCipher.loadEncryptedKey(Unknown Source)
        at uoc.cripto.fases.fase21.decipherRSA(phase21.java:82)
        at uoc.cripto.fases.fase21.main(phase21.java:100)I suppose that the problem is in the way I'm serializing to a file the ciphered XML document, or maybe the method to deserialize it. I'm using this code to serialize to a file:
    public static void writeFile(Document doc, String fileName) throws Exception {
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer();
        Source input = new DOMSource(doc);
        FileWriter writer = new FileWriter(fileName);
        Result output = new StreamResult(writer);
        transformer.transform(input, output);
    }And for deserializing:
    public static Document readFile (String fileName) throws Exception {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        File file = new File(fileName);
        Document doc = builder.parse(file);
        return doc;
    }Can anyone help me? I'm seriously lost, and I need to solve this problem in order to pass a subject...
Thanks.

Hi, all.
I've found the answer. It's enough to insert this line in the "readFile" function:
        factory.setNamespaceAware(true);The exception seems to be thrown because the system can't find certain elements if the property NamespaceAware is false, and this is the default value.
So, that's all, folks!
Thank you for your patience,

Similar Messages

  • Pls tell me how to know more about encryption

    pls tell me how to know more about encryption things, such as JCE and etc

    Read a book. Take a class. Search the Internet.

  • XML encrypt/decrypt

    Hi All,
    I'm a newbie, and want to know if the output XML file (UUT test report) from TestStand can be encrypted without using any third party software?
    Actually I want to know if TestStand itself supports encryption/decryption of XML?
    And if TestStand doesn't supports, is there any work around for this requirement?
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

    Hello,
    Encryption in XML file is required to encrypt the various configuration parameter values so that a user cannot view / edited it external outside the to the test application. By making use of Private / Public keys data would be encrypted.This key will be exchanged between TestStand & XML to decrypt & display it to user.
    See additional details on XML encryption on : http://www.w3.org/TR/xmlenc-core/
    We can encrypt the step result using LabVIEW encryption example --> http://zone.ni.com/devzone/cda/epd/p/id/3473
    My question now is --> How to include the customize XML report header to include the encryption standard?
    I saw many articles to make use of "ModifyReportHeader". Can someone furnish me with a working example of modifying the header through TestStand? I tried ... but in Vain..

  • Explain about xml schema with example

    Hi,
    Kindly anybody explain about xml schema with example?
    With Regards,
    L.rajesh

    Maybe this is what you are looking for ??? If not give us more info...
    Re: How it work?

  • Why are people so crazy about XML publisher?

    Why are people so crazy about XML publisher? Maybe there are things I am not aware of, but with the exception of adding the ability to export to Excel from EBS, or having a template for a letter in which a few things will change from copy to copy, I don't see a huge advantage to using it.
    Reports is such a powerful tool and creates so much flexibility in creating graphical documents. Things that are so easy to do in reports, from my experience, is extremely difficult to impossible in XML publisher. In publisher, you have to do a lot of logic yourself that reports would do for you just by saying Yes or No to a property.
    When I first learned about XML publisher, I was really excited about learning to use it. But when I saw how difficult it is to do simple tasks, and how much you have to reinvent the wheel, I became really disappointed. There are lots of examples on the web about how to do this or how to do that with it, but honestly they seem to show you how to go to a lot of trouble to accomplish something that is easy in reports.
    People seem to want to avoid bitmapped reports like the plague, but I think they are extremely underrated.
    What do you guys think? Am I missing something? I would like to hear other opinions and perspectives.
    Thanks,
    Kurz

    Hello Kurz,
    BI Publisher (XML Publisher)
    - can use any relational DB
    - can easily be connected to Oracle Applications (Siebel, JD Edwards, ...)
    - Templates can be edited by users
    - more output formats
    Have a look at http://www.oracle.com/technology/products/xml-publisher/docs/BI_Publisher_for_Apps.pdf
    or the product home at http://www.oracle.com/technology/products/xml-publisher/index.html
    Regards
    Marcus

  • Question about XML validation against schema

    My question is probably a basic one about XML. I tried PurchaseOrder example from the book "J2EE Web Services" by Richard Monson-Haefel. A simplified version as followings -
    Address.xsd -
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/Address"
    xmlns:addr="http://xml.netbeans.org/schema/Address"
    elementFormDefault="qualified">
    <element name="address" type="addr:USAddress" />
    <complexType name="USAddress">
    <sequence>
    <element name="name" type="string" />
    <element name="street" type="string" />
    <element name="city" type="string" />
    <element name="state" type="string" />
    <element name="zip" type="string" />
    </sequence>
    </complexType>
    </schema>
    PurchaseOrder.xsd -
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/PurchaseOrder"
    xmlns:po="http://xml.netbeans.org/schema/PurchaseOrder"
    xmlns:ad="http://xml.netbeans.org/schema/Address"
    elementFormDefault="qualified">
    <import namespace="http://xml.netbeans.org/schema/Address" schemaLocation="Address.xsd" />
    <element name="purchaseOrder" type="po:PurchaseOrder" />
    <complexType name="PurchaseOrder">
    <sequence>
    <element name="accountName" type="string" />
    <element name="accountNumber" type="unsignedShort" />
    <element name="shipAddress" type="ad:USAddress" />
    <element name="total" type="float" />
    </sequence>
    <attribute name="orderDate" type="date" />
    </complexType>
    </schema>
    Then PurchaseOrder.xml is -
    <purchaseOrder orderDate="2007-12-12"
    xmlns='http://xml.netbeans.org/schema/PurchaseOrder'
    xmlns:addr="http://xml.netbeans.org/schema/Address"
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xsi:schemaLocation='http://xml.netbeans.org/schema/PurchaseOrder ../xsd/PurchaseOrder.xsd'>
    <accountName>Starwood</accountName>
    <accountNumber>220</accountNumber>
    <shipAddress>
    <name>Data Center</name>
    <street>1501 Washington St.</street>
    <city>Braintree</city>
    <state>MA</state>
    <zip>02148</zip>
    </shipAddress>
    <total>250</total>
    </purchaseOrder>
    Then I did a XML validation but have this error -
    cvc-complex-type.2.4.a: Invalid content was found starting with element 'name'. One of '{"http://xml.netbeans.org/schema/Address":name}' is expected. [19]
    It complains <name> tag in <shipAddrss> needs namespace of "http://xml.netbeans.org/schema/Address". Why?
    Is it possible to change XML so it does not need name space for elements inside <shipAddress>?
    Thanks

    Hi Madhura,
    see here my comparison of the web version against the local file version on my Windows box (which is itself not the fastest): It makes a factor 16 in difference!
    C:\Temp\xsdvalidator>java XsdValidator madhu.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 16353 ms
    C:\Temp\xsdvalidator>java XsdValidator madhu_local.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 994 ms
    Obviously, the w3c.org domain that you specified as ressource location is very slow - and, as the FAQ shows, this delay is intentional!
    The W3C servers are slow to return DTDs. Is the delay intentional?
    Yes. Due to various software systems downloading DTDs from our site millions of times a day (despite the caching directives of our servers), we have started to serve DTDs and schema (DTD, XSD, ENT, MOD, etc.) from our site with an artificial delay. Our goals in doing so are to bring more attention to our ongoing issues with excessive DTD traffic, and to protect the stability and response time of the rest of our site. We recommend HTTP caching or catalog files to improve performance.
    --> They don't want to have requests to their site from productive servers all around the world.
    Regards,
    Rüdiger

  • Considering FileVault usage on an iMac with OSX 10.6.7. Wanting to know more about strengths and weaknesses of Filevault with Time Machine, Parallels and Carbon Copy Cloner. Any negatives to consider before flipping the switch?

    I'm considering FileVault usage on an iMac with OSX 10.6.7. Wanting to know more about strengths and weaknesses of Filevault with Time Machine, Parallels and Carbon Copy Cloner. Any negatives to consider before flipping the switch? Any information ?
    Would specifically like to know:
    Filevault impact on performance and application usability.
    TIme machine impacts, and whether TIme Machine volume will also be secure?
    Will a Cloned copy made with CCC be  bootable, or usable?
    Any other negatives to consider before turning this thing on?
    Thanks,

    Filevault impact on performance and application usability.
    FileVault encrypts the user's home directory only - it is basically an encrypted disk image that is automatically opened when you log in and closed when you log out. It does cause disk accesses to be a bit slower so it isn't a good idea to use an encrypted account with sound or video or large graphics files. I have no experience with it with Parallels Desktop but suspect that you'd notice a bit of a slowdown. Note: in the User's directory you'll see a Shared Folder. Since FV only encrypts the user's directory you can put data you don't need encrypted in this shared folder which won't be encrypted.
    TIme machine impacts, and whether TIme Machine volume will also be secure?
    There are issues with TM and FV but how extensive they are with Snow Leopard I can't say, once I realized that TM and FV hadn't substantially changed between 10.5 and 10.6 I stopped dealing with it. When FV and TM were first introduced my testing led me to recommend using CCC or SuperDuper! for backing up.
    Will a Cloned copy made with CCC be  bootable, or usable?
    Yes
    Any other negatives to consider before turning this thing on?
    Since FV is nothing more than a disk image - and disk images can fail - there are several problems with FV in my opinion. If an encrypted disk image fails it isn't possible to access any of that data. If you don't have a recent (undamaged) backup of the disk image and/or recent backup of the data within the disk image you are in a world of hurt. This isn't just a warning of possibility - this is a real danger that I've seen all too often at the shop where I have worked part time for a number of years.
    At this time I strongly recommend that people who have sensitive data keep that sensitive data segregated from their general data and encrypt only the sensitive data or use other methods of locking it down such as saving on an external drive that is kept in a safe. Call me paranoid but I don't even keep all my sensitive data in one encrypted disk image. I use multiple disk images and keep multiple sequential backups. That way I might someday find that my up-to-date investments disk image won't mount but (a) I can go back a week to a backup and (b) that won't impact my up-to-date business records because those are in a different disk image

  • Where can I learn more about Siri?

    Siri works pretty well for me (for a Beta component) since I do not have a strong regional accent,  but I want to learn more about what it can do, how best to pose questions for successful interactions and follow its progress as it is updated by Apple. Any suggestions for good resources?

    Here's a place to start: Learn more about Siri

  • Where can I learn more about the Logic Environment?

    I've been using LogicPro for a while now - since version 7 came out - and I'm ready to learn more about the mysterious Logic Environment. Anyone know of a good tutorial or website on this topic? I don't have a specific question - what I need is a general overview.
    My sessions are primarily audio recording and mixing with a virtual instrument from time to time. I rarely use MIDI except to play the synths and instruments.
    My environmental experience so far has been limited to creating and naming audio objects, accessing "hidden" faders and as an alternate to the mix views provided in the global and track mixers.
    I'd prefer free advice but I'm not against paying if it's worth it. I have read the manual but I have a feeling that it will be more helpful once I have a better grasp on the big picture. It's a reference manual more than a how-to.
    My MIDI devices are an Axiom-61 and PreSonus FaderPort.
    Thanks,
    John
    Message was edited by: John Curley

    Apple has what they call "online seminars" available on the main Logic page
    http://www.apple.com/logicpro/
    If you look on the bottom right hand side of the page, you see a link for online seminars. You'll have to go through a regstration process, then you can watch 3 or 4 streaming Quicktime videos of people using different functions in Logic. There's nothing really in depth there, but it does show you a few useful shortcuts and methods.

  • I am new in using Mac operating system, kindly suggest ebooks , videos or audio books to me so that i can learn more about it?

    i am new in using Mac operating system, kindly suggest ebooks, videos or audio books to me so that i can learn more about it.
    any kind of help would be appriciated. i am very eager to learn.how to make ios application? and how to effectively use terminal? where does the basic programming start in Mac? what are the different tools that can help me make an Mac application and ios application.
    -Thank you
    Shailendra (India)

    Apple has got some great guides to start developing in Objective-C, used for programming OS X and iOS apps > http://developer.apple.com/library/mac/#referencelibrary/GettingStarted/RoadMapO SX/chapters/01_Introduction.html

  • Why would it state under the "more about this mac" that i already have10.8.3 and then in the app store say i need to "resume" do you know what i mean? is it possible i already did download mountain lion entirely once? I am confused and don't want it twice

    why would it state under the "more about this mac" that i already have10.8.3 and then in the app store say i need to "resume" do you know what i mean? is it possible i already did download mountain lion entirely once? I am confused and don't want it twice

    This is cause by the way the App Store checks to see if an application is installed on your system.
    Basically when an app is installed it is in the Applications folder and this is where the MAS looks for them. So it looks at your purchase history for the apps you bought and looks in the Applications folder to see if they are installed. If an app is in your purchase history but not in the Applications folder the MAS says you need to install it.
    For normal apps this works fine but the OS doesn;t install into the Applications folder. So the MAS sees you have Mountain Lion in your purchase history but it's not in the Applications folder and so it says you need to download it.
    Hopefully one of these days Apple wil fix this.
    regards

  • Want to know more about Business Analytics in SAP and its scope

    Hi all,
    I would like to know more about Business Analytics in SAP and its scope. My wife has finished her MBA (HR) and currently working as HR. She is more interested Business analytics, so please guide her how to startup her career in this field in the entry level, what prerequisites should be met and how the job market will be.
    Thanks a lot in advance.
    Srini

    Dear,
    Its good decision to go with Business Analytics in SAP ERP.
    Both businesses and SAP AG no more requires consultants, requires efficient dynamic skilled business analytics professionals to advance in current international market. Business Strategic planning plays a major role in Business Analytics.
    If you search google with "Business analytics" you will find hundreds of results which everyone of us has to read and learn what really stands for Strategy and Planning.
    http://www.sap.com/corporate-en/press.epx?pressid=14491
    http://marksmith.ventanaresearch.com/2011/02/25/sap-retrofits-business-intelligence-and-information-management-to-meet-it-and-business-needs/
    http://www.sap.com/solutions/sapbusinessobjects/index.epx
    As you mentioned, its not a difficult task for an MBA(HR) person to read and understand the subject available.
    Please check and Best of luck.
    Regards,
    Syed Hussain.
    P.S: "no more requires consultants" my intention is already plenty of consultants in market today. When competition is tough and plenty - invent new technologies and upgrade.
    Edited by: Syed Hussain on Jun 22, 2011 9:21 AM

  • Learning more about the features in PS touch

    I was looking at PS touch, maybe for my ipod mini.
    I was hoping to get more of a sense of what the features are, but it seems Adobe has replaced information with hype, giving us the Disney version of what their programs are about.
    I'd like to know more about the features of PS Touch, specifically:
    I assume I can use layers, but do they have modes such as darken, lighten, overlay, soft light, etc?
    Can I create masks in these layers, so I have control over which part of the layer is applied to the image?
    Does the curves tool have more than 3 points to adjust, can you add points as with full PS?
    If I was working off my camera's memory card hooked up to the iPod mini, can I then do a save as of the image I'm working on, either saving it to the card or my device (in part to create a new image and to also keep the original) ?
    It's very frustrating that this information is not more readily available to us. also, I may have missed it, but i didn't see a link to the forums from the Adobe pages, not under Learning, or about Adobe, or?
    Regards, David

    In order:
    Yes, PS Touch uses layer blending modes just like in Photoshop (and Photoshop Elements). It doesn't have *every* blending mode, but the basics (like the ones you listed) are there.
    The best that I can explain it as far as "masks" in PS Touch goes is that you paint your desired effect onto your image (via the Effects Paint tool). You do not need a mask layer per se as the effect is contained as you paint over the desired area. (You can adjust size, hardness, flow and opacity of the brush in this tool. If you have a tablet with pressure-senstive support, you can control size and opacity as well dynamically like you would with a Wacom graphics tablet connected to a desktop.)
    You can add/subtract as many points as you want in the Curves adjustment. (There's a general Curves adjustment and one provided under the Effects Paint tool; both use the same interface for options.)
    I don't think so, as the file system in PS Touch is self-contained (at least under Android; not sure about iOS). When you go to save a project, it's added into the main interface. (You can create folders to manage these projects, btw.) You can then export projects under a desired file type (like PSD or JPEG) locally or to a service like Adobe's own Creative Cloud or Dropbox.

  • I want to know more about the Sanapshot tool. What is its purpose? how do I use it?

    I want to know more about the Sanapshot tool. What is its purpose? how do I use it? I have searched Firefox Help, but did not find a clear answer.

    That is not part of Firefox. It is either an add-on for Firefox which you installed, or it is a separate program you have.
    Also, is '''Sanapshot tool''' the correct name? Or did you mean '''''Snapshot'''''?

  • Hi,   I am trying to find out a bit more about creative cloud...  I currently use PS5 extended...  I have it on my desk top at home but travel often and use a pc. which does not have PS5 because it is licensed to mac...  So i am now thinking of using the

    hi,   I am trying to find out a bit more about creative cloud...  I currently use PS5 extended...  I have it on my desk top at home but travel often and use a pc. which does not have PS5 because it is licensed to mac...  So i am now thinking of using the cloud...  will i be able to use it on both computers? and will it work if there is slow or no internet?.

    Here are some links to general information.  IF you have specific questions feel free to ask...
    Creative Cloud Learn & Support
    http://helpx.adobe.com/creative-cloud.html
    Creative Cloud / Common Questions
    http://helpx.adobe.com/creative-cloud/faq.html
    Creative Cloud Plans
    https://creative.adobe.com/plans

Maybe you are looking for