How to set/get the initialization vector

Hi,
I have an existing database (built by non-java code) containing encrypted data. I know the algorithm, the key and the initialization vector to use in order to decrypt this data. (This is straight-forward DES encryption.)
My problem is that I can't tell from the java documentation how to set the initialization vector on a Cipher object when I need to perform decryption.
As an aside, when I try and encrypt data - the results from Cipher.getIV () are always null.
Any help greatly appreciated,
Thanks,
--Jatinder                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

To set the initialisation vector for a Cipher, you need to use the IvParameterSpec class and specifically create the initialisation vector. This class implements the AlgorithmParameterSpec interface. This is used in one of the init() methods for the Cipher class when you set up the Cipher (ie. it accepts parameters for the mode, key and parameter spec). I also found that this was difficult to work out from the supporting documentation.
To get the initialisation vector for a Cipher, use the getIV() method after you have performed the init() call. If the vector has not been initialised before the init() call, you mayget a random result. If it has been initialised specifically, it will print out the vector that you initialised it with - I have tried this out.
Hope this helps.

Similar Messages

  • How to set/get the archive file attribute?

    I am programing a (freeware!) ftp client and need to know, how to set/get the archive attribute of a local file. I was searching through whole the i-net - nothing at all!
    please help me!!

    Hi,
    Since not all operating systems support the archive attribute, this ain't included in the JDK.
    If you're using Microsoft Foundation Classes for Java, then you can use File.getAttributes(String path) and check whether the result equals FileAttribute.ARCHIVE.
    For setting the attribute, you can use
    File.setAttributes(String path, FileAttribute.ARCHIVE)
    Of course this is all Microsoft-specific stuff.
    Hope this helps,
    Kurt.

  • How to set/get the values thru Wedbynpro coding for User mapping fields

    Hi All
    In system object we have the user mapping fields like District,city,plant,Salesmanager.
    now we want to set/get the values of these usermapping fields of system object thru webdynpro coding...
    if anybody have sample codes of the same then it would be great help to me
    Thanks in advance
    Thanks
    Trisha Rani

    Hi Kavitha
    Thanks for your reply
    My requirement is exactly as follows.
    1) i have created one portal system object in system administration and also i created usermapping fields in the system object from the usermanagement  in system object.
    i created the user mapping fields like Plant,SalesManager,District etc.
    i also created the system alias name for the same system object
    2)  Now i came to persoanlize link and mapped the system object to the portal user.
    while mapping to the system object we need to enter Mapping userId, Password , once we enter these values and we can also enter the values of usermapping fields which we defined while creating the system object ( for example District,Salesmanager,Plant etc)
    once we enter all the values and click on save then these usermapping  values to be mapped to the portal user.
    3) Now my requirement is , i  want to control the usermapping field values thru webdynpro coding for setting/getting the values.
    I need sample code of the same.
    Please let me know if u need more details on the same.
    Thanks
    Trisha Rani

  • HT4796 I used migration to transfer iTunes from pc to mac book. It had me set up another user account. Now i have 2 user accounts and i have the iTunes on the wrong one. How do i get the iTunes on the original account.

    I used migration to transfer iTunes from pc to mac book. It had me set up another user account. Now i have 2 user accounts and i have the iTunes on the wrong one. How do i get the iTunes on the original account.

    In Mail Preferences/Accounts/each GMail account, set up the SMTP Outgoing Server for each account separately, going into SMTP name/edit/Advanced and specify the Username of each account.  The Outgoing servers must be two different servers, authenticated by the Username and Password of each.
    Otherwise, the GMail SMTP server will change the from address to that of the account where the SMTP server was setup.
    Ernie

  • I set up an apple id for my 12 year old, a verfication email was sent, but google has locked her out because of age.  How do I get the verfication email?

    I set up an apple id for my 12 year old, a verfication email was sent, but google has locked her out because of age.  How do I get the verfication email?
    Should each person in my house have their own apple id and password?
    Can each of the different ID's be linked back to my apple account so that when they purchase apps and music it will be charged to my credit card?

    alyssa1105 wrote:
    I set up an apple id for my 12 year old, a verfication email was sent, but google has locked her out because of age.  How do I get the verfication email?
    Ask Google... they locked you out of the email account.

  • How do I get the Measurement scale to stay set in Adobe Acrobat IX Pro. It's easy to set the scale , but when you exit out of the commend

    How do I get the Measurement scale to stay set in Adobe Acrobat IX Pro. It's easy to set the scale , but when you exit out of the commend the scale is reset to 1 = 1.

    Thank you for checking, Tom,
    I'm confused. What do YOU get when you push the feed button? And why is it working on yours and not either of my machines?
    Today, my Mac (w/Safari 4) gets the same error message: Safari can’t open the page Safari can’t open the page “feed:http://vibrationalvoyages/vibrationalvoyages.com/DivineLight_Vibrations_Principles_andApplications/rss.xml”. The error is: “The feed could not be loaded because the content is not in a known feed format.”
    My little ASUS (with a Linux operating system) gets a screen that says "The requested URL was not found". The URL on that page is http://vibrationalvoyages./vibrationalvoyages.com/DivineLight_Vibrations_Principles_andApplications/rss.xml
    On both error messages, the URL I was checking was:
    http://www.vibrationalvoyages.com/DivineLight_Vibrations_Principles_and_Applications/Divine_Light_Vibrations_Principles_ andApplications.html
    The last URL was, of course, the URL generated by iWeb.
    So, my question still is:
    HOW CAN I GET MY FEEDS TO WORK PROPERLY? If the problem is there shouldn't be an http:// after feed: then, how do I get iWeb to set it up properly?
    Any ideas?
    GG

  • I just received my new phone from Verizon, I turned it on and followed direction for set up...now I lost my connection with ATT....How do I get the service back from ATT...not due to change until the 16th

    I just received my new 6 from Verizon by mail.  I was not due to change carriers til the 16th, but I turned on the new phone and did the set up...now I lost ATT.  How do I get the ATT carrier back on my old phone?

    I just received my new 6 from Verizon by mail.  I was not due to change carriers til the 16th, but I turned on the new phone and did the set up...now I lost ATT.  How do I get the ATT carrier back on my old phone?

  • I have an old itunes act with a lot of songs that i set up before i owned an iphone. now that i have an iphone i have a new act. my question is how do i get the songs from the old act onto my new iphone?

    I have an old itunes act with a lot of songs that i set up before i owned an iphone. now that i have an iphone i have a new act. my question is how do i get the songs from the old act onto my new iphone?

    Hello brjdunn,
    Thanks for using Apple Support Communities.
    You are able to change your Apple ID by following the instructions below.  That way you will still have access to all of your previous purchases:
    Change your Apple ID
    http://support.apple.com/kb/HT5621
    Take care,
    Alex H.

  • HT1349 How do I set up a speed dial on my iPhone 4s?  I am used to the bberry where I just keep my finger on a number in order to dial. This is very useful in the car.  How do I get the same effect on iPhone?

    How do I set up a speed dial on my iPhone 4s?  I am used to the bberry where I just keep my finger on a number in order to dial. This is very useful in the car.  How do I get the same effect on iPhone?

    I found a post from Alope that told me exactly how to fix it.
    Go to:
    Settings   - General   - Restrictions    -    put your pass code in   -     Facetime      -  turn the switch to ON
    Worked perfectly to stop the message that said, Not authorized to do that!

  • TS2972 I have 4 Apple TV's. All set up to Home share. One will not see the computer. It is also the only 720 I have. The other three are 1080's. How do I get the 4th one (the720) to recognize my Mac?

    I have 4 Apple TV's. All set up to Home share. One will not see the computer. It is also the only 720 I have. The other three are 1080's. How do I get the 4th one (the720) to recognize my Mac?

    Need more information to help you, but I am providing some suggestions.  Sorry if you are past these type of basic things.  But didnt really have much to start with and understand your technical level to start with. 
    Have you got into Settings > Computers > Turned on Home Sharing (Note: You must use the some Apple ID used by the iTunes library on your MAC for them to see one another)
    How is your MAC connected to the network vs the 720 ATV2?  Is one WiFi and the other Ethernet?  Have you tried switching the ATV2 to WiFi if Ethernet? 
    Has the MAC been restarted since this started happening?  Same with your Router and any other networking device being used?  Sometimes an IP conflict can arise in your networking and most consumer networking equipment does not know how to "self heal" without a reboot. 
    Make sure you have given those things a whirl and share back your results.  Any other information you can provide, such as how you connect to your network from each ATV and MAC. 

  • Connot get it to accept cookies; privacy settings are re-set each time after I change them. How can I get the privacy setting to stick and accept cookies?

    I need to accept cookies to log into a technical site. I clear all cookies and the history and follow the instructions for setting privacy options to "Use custom settings for history" and to accept all cookies. When I go back to try logging into the site, it still tells me cookies aren't accepted. When I go back to Options-Privacy, the setting has been changed back to "Remember history" from "Use custom settings for history". I have done this about 5 times, trying various options, closing Firefox after making the change and starting it again - nothing works. How can I get the privacy settings to stay as I set them and accept cookies?

    Blocking all cookies in Safari does not work. Deleted cookies will not stay deleted. There are numerous threads on this going back years, both in these forums and elsewhere. Many claim to have submitted the issue to Apple, but I have never seen anyone post a reply.
    I have seen many suggested fixes that involve finding the cookies file, some including Terminal manipulations, and none seems to work universally. I can find noplace where Apple addresses this officially with an actual Apple-approved explanation or how-to.
    Bottom line, your browser's security features should do what they claim: delete cookies. When they come back without ever even visiting another page, this is clearly not working in the way a reasonable user would expect.
    Bottom line, Safari does not protect users' privacy in the way it pretends to and, after so many years of this issue, it appears that Apple wants it this way.
    Having spent way too much time on this, I realize the choice is between Safari which is pretty well optimized; Firefox which is a lot pokier, at least for me; and Chrome, which I assume funnels personal information directly to Google.

  • Phone asked for voicemail password after update to iOS5. I pushed cancel bc I didn't know it. Now I now it but the screen just says set-up. How do I get the prompt to appear again?

    Phone asked for voicemail password after update to iOS5. I pushed cancel bc I didn't know it. Now I now it but the screen just says set-up. How do I get the prompt to appear again?

    usaspirit88 wrote:
    Phone asked for voicemail password after update to iOS5. I pushed cancel bc I didn't know it. Now I now it but the screen just says set-up. How do I get the prompt to appear again?
    Try typing in your 10 didget cell number. Restart iPhone to get the prompt again.

  • How can I get the PDF to retain margins set in Word document?

    Uploaded a Word 2003 document for conversion. Conversion to PDF successful, but the PDF has different margins and page breaks. How do I get the PDF to retain the set margins?

    Hi NancyS,
    If you're on Windows, you can try using the PDF Desktop printer to "print" your document to PDF format. Here are the instructions for installing and setting up the PDF Desktop printer: Install and configure Adobe CreatePDF Desktop Printer.
    Please let us know if you have better luck using the PDF Desktop Printer.
    Best,
    Sara

  • I have entered the wrong numbers to put my phone in pass code lock.  However, I didn't set the autolock....how can I get the pass code lock reset?

    I have entered the wrong numbers to put my phone in pass code lock.  However, I didn't set the autolock....how can I get the pass code lock reset?

    Your only choice is to place the phone in DFU mode (search Google for instructions) and restore as a new device.  You will lose all your data.

  • 9600t in windows. how do i set it to the 9600 gt card how do i get the best

    9600t in windows. how do i set it to the 9600 gt card how do i get the best preformace. i mean in osx you have to switch between the to by logging out. how do i get the best graphics preformance in windows with this card and how do i tune it on in windows

    oh really nice i had no idea. Do i have to loook for a firmware update or anything of that nature..

Maybe you are looking for