create the example simple encrypt/decrypt string - but without success

Being a newbie crypt I'm trying to build an example of simple string encryption/decryption, but somehow the decrypted result differs too much :-)
Can someone tell me the error in my reasoning? Thank you!

import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
Import javax.crypto.BadPaddingException;
Import javax.crypto.Cipher;
Import javax.crypto.IllegalBlockSizeException;
Import javax.crypto.NoSuchPaddingException;
Import javax.crypto.spec.SecretKeySpec;
public class dum_8_decrypt64 {}

Public Shared Sub main (String [] args) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {}

Dim input As String = "Hello, world!";
String key = "nv93h50sk1zh508v";
SecretKeySpec key;
Encryption cipher = null;
Encryption by dcipher = null;
The string result, dresult;

key = SecretKeySpec (passkey.getBytes (new), "AES");

encryption = Cipher.getInstance ("AES/ECB/PKCS5Padding", "Sunjce())");
Cipher.init (Cipher.ENCRYPT_MODE, Key);

result = new String (cipher.doFinal (input.getBytes ()));

System.out.println ("encrypted-> string" + result + "<-");

dcipher = Cipher.getInstance ("AES/ECB/PKCS5Padding", "Sunjce())");
dcipher.init (Cipher.DECRYPT_MODE, Key);
dresult = new String (cipher.doFinal (result.getBytes ()));


System.out.println ("decrypted-> string" dresult + "<-");

}
}

Output:

Encrypted-> string.
p ÿƒG¬µ? (.« <----------


The decrypted-> string Qbkuu $Ñ 5oaw'?) ; Yeutdp3wvk < -.

Encrypted data is binary.

String is not a container for binary data.

Tags: Java

Similar Questions

  • I have a problem with creative cloud applications is not to be downloaded or updated date on my i mac, current applications, I still have work. I uninstalled the cc application and re-installed but without success, in the apps tab there is no error code o

    I have a problem with creative cloud applications is not to be downloaded or updated date on my i mac, current applications, I still have work. I uninstalled the cc application and re-installed but without success, on the applications tab there is no code error only saying download error out area allowing you to charge applications call does not work... any suggestions?

    Hi James,

    Please follow the article: CC help | Download error in the applications tab of Creative Cloud Desktop Application to get this fixed number.

    Please let us know any questions.

    Thank you

    Yann Arora

  • «The video add-on drive could not install: impossible to validate the license online.» How can it help me? I tried the Extension handles CC too. But no success.

    «The video add-on drive could not install: impossible to validate the license online.» How can it help me? I tried the Extension handles CC too. But no success.

    This error indicates usually that one of the following problems:

    • You are not connected to Creative CC Cloud Desktop App and/or Adobe site with the same Adobe ID modules.
    • More than one user is logged in your Adobe software on your computer using an Adobe ID different from yourself, or indeed you have more than one Adobe ID that you used to connect to and the license file is damaged.
    • You are behind a firewall that blocks our license server calls.

    Please first make sure that you are connected to the Adobe website modules (top-right) and the desktop application CC (high button on the page of good settings, preferences, account) with the correct ID. If you are, then next steps are please uninstall and reinstall the extensions, reset between Manager.

  • I've just updated to LR5.  I also have a new camera.  Nikon D800.  Try importing directly (from the camera) in LR.  But without success. Get the following message.  "The files are a camera which is not recognized by the raw format support in Ligh.

    I've just updated to LR5.  I also have a new camera.  Nikon D800.  Try importing directly (from the camera) in LR.  But without success. Get the following message.  "The files are a camera which is not recognized by the raw format support in Lightroom."  How can I import it please?

    I find the program file for Lightroom 5 and make an icon of office for him. And I would get rid of Lightroom 3. If you open Lightroom 3 and you see images in the old catalog, not the updated one.

  • Vista OS does not load. I tried booting and the load screen bar continues to work without success. When you run the start he stops to c:\windows\system 32\cmd.exe that I don't want to lose my files so I have not reinstalled. Any suggestions?

    Vista OS does not load.  I tried booting and the load screen bar continues to work without success.  When you run the start he stops to c:\windows\system 32\cmd.exe that I don't want to lose my files so I have not reinstalled.  Any suggestions?

    Restore point:

    Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.

    Try a restore of the system once, to choose a Restore Point prior to your problem...

    Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     

    If restore work not and you do not have a Vista DVD from Microsoft, do a repair disc to do a Startup Repair:

    Download the ISO on the link provided and make a record of repair time it starts.

    Go to your Bios/Setup, or the Boot Menu at startup and change the Boot order to make the DVD/CD drive 1st in the boot order, then reboot with the disk in the drive.

    At the startup/power on you should see at the bottom of the screen either F2 or DELETE, go to Setup/Bios or F12 for the Boot Menu.

    When you have changed that, insert the Bootable disk you did in the drive and reboot.

    http://www.bleepingcomputer.com/tutorials/tutorial148.html

    Link above shows what the process looks like and a manual, it load the repair options.

    NeoSmart containing the content of the Windows Vista DVD 'Recovery Centre', as we refer to him. It cannot be used to install or reinstall Windows Vista, and is just a Windows PE interface to recovering your PC. Technically, we could re-create this installation with downloadable media media freely from Microsoft (namely the Microsoft WAIK, several gigabyte download); but it is pretty darn decent of Microsoft to present Windows users who might not be able to create such a thing on their own.

    Read all the info on the website on how to create and use it.

    http://NeoSmart.net/blog/2008/Windows-Vista-recovery-disc-download/

    ISO Burner: http://www.snapfiles.com/get/active-isoburner.html

    It's a very good Vista startup repair disk.

    You can do a system restart tool, system, etc it restore.

    It is NOT a disc of resettlement.

    And the 32-bit is what normally comes on a computer, unless 64-bit.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Data recovery, if/before you reinstall:

    1. slave of your hard drive in another computer and read/save your data out there.

    2. put your Hard drive in a USB hard drive case, plug it into another computer and read/save from there.

    3 Alternatively, use Knoppix Live CD to recover data:

    http://www.Knopper.NET/Knoppix/index-en.html

    Download/save the file Knoppix Live CD ISO above.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    http://isorecorder.alexfeinman.com/isorecorder.htm

    Download the Vista software from the link above.

    After installing above ISO burning software, right click on the Knoppix ISO file > copy the Image to a CD.

    Knoppix is not installed on your PC; use only the resources of your PC, RAM, graphics etc.

    Change the boot order in YOUR computer/laptop to the CD/DVD Drive 1st in the boot order.

    Plug a Flash Drive/Memory Stick, BOOT with the Live CD, and you should be able to read the hard drive.

    When the desktop loads, you will see at least two drive hard icons on the desktop (one for your hard drive) and one for the USB key.

    Click on the icons of hard drive to open and to understand which drive is which.

    Click the icon for the USB drive and click on "Actions > Change the read/write mode" so you can write to disk (it is read-only by default for security reasons).

    Now to find the files you want to back up, just drag and drop them on the USB. When you're done, shut down the system and remove the USB key.

    See you soon.

    Mick Murphy - Microsoft partner

  • I'm trying to open Media Encoder - but without success

    I'm trying to open Media Encoder - but without success. He use to work perfect

    When I start it up, he tells me he's going clouse downwards. What can I do to restore the program?

    Media Encoder is CS6

    Windows 7

    Can you try to keep Alt + Ctrl (Win) cmd (Mac) + SHIFT while launching the SOUL?  This clears the application preferences and can help.

  • HP pavilion p250ur: can not find the driver PCI encryption/decryption controller

    Hello! I can not find PCI encryption/decryption controller driver. Windows 8.1

    Hello:

    Give this one a try...

    http://h20566.www2.HP.com/hpsc/SWD/public/detail?sp4ts.Oid=5449369&swItemId=ob_128754_1&swEnvOid=4158

  • Manipulation of the Phonlog but without success in removing an element

    Hello

    I wrote a small application that needs to manipulate the last entry in the phonelog. I want to replace the number dialed by a custom filter. Only the custom number must be in the newspaper. Writing number custom works very good journal but by removing the number dialed does not work. I read in another thread that der had a problem with the removal of items phonlog in v4.2. I develop on version 4.5 fact that the problem persists or I did something wrong (see list below).

    import java.util.Vector;import net.rim.blackberry.api.phone.phonelogs.CallLog;import net.rim.blackberry.api.phone.phonelogs.PhoneCallLog;import net.rim.blackberry.api.phone.phonelogs.PhoneCallLogID;import net.rim.blackberry.api.phone.phonelogs.PhoneLogs;import net.rim.device.api.system.PersistentStore;import net.rim.device.api.util.StringMatch;
    
    public class PhoneLogListener implements     net.rim.blackberry.api.phone.phonelogs.PhoneLogListener {
    
      private AsteriskMenuItem caller;  private boolean editFlag = false;
    
       public PhoneLogListener (AsteriskMenuItem theMenuItem)    {     caller = theMenuItem; }
    
      public void callLogAdded(CallLog cl) {
    
              PhoneCallLog myLog = ((PhoneCallLog)cl);
    
              //get ne number to be write in the log            String participantNumber =  (myLog.getParticipant()).getNumber();         //get the current service number from the persistent store (String)           Vector persStore  = (Vector) (PersistentStore.getPersistentObject( 0xd4b6b5eeea339daL )).getContents();           String currentServiceNumber = (String)persStore.firstElement();
    
              //if the participantnumber starts with the servicenumber we did come from the application and want to edit the logentry           if (participantNumber.startsWith(currentServiceNumber));          {             //set the number we want to show                                myLog.setParticipant(new PhoneCallLogID(caller.getPhoneNumber2()));
    
                                    //remove the listener to prevent an endless loop                PhoneLogs.removeListener(this);
    
                                    //---> the folowing does not work                    //(PhoneLogs.getInstance()).deleteCall(0, PhoneLogs.FOLDER_NORMAL_CALLS);             //---> the folowing works                                (PhoneLogs.getInstance()).addCall(myLog);           }
    
       }
    
     public void callLogRemoved(CallLog cl) {      // TODO Auto-generated method stub
    
      }
    
       public void callLogUpdated(CallLog cl, CallLog oldCl) {       // TODO Auto-generated method stub
    
      }
    
       public void reset() {     // TODO Auto-generated method stub
    
      }
    
    }
    

    The invokeLater proved to be crucial for my scenario.

    You can learn more here:

    http://tinyurl.com/dlg36t

    Or search through the forums.

  • How to create the new library of Photos to iCloud without it merging with the former?

    I started my iCPL in January 2015. It is now 104 Gb/8000 photos. In a year I need to upgrade my plan of storage iCloud.

    So I think I would make the existing one a regular photo library, and start a new photo library iCloud.

    If I start a new library now and make the iCPL, merge it with the existing iCPL. I want to replace the existing in iCloud.

    I could do (I think): -.

    1. make the existing a non-iCPL and rename it.

    2. create a new lib Photos and make the library system iCloud.

    3. the new library (empty) will download and merge with the former in iCloud, so it contains now 8000 photos of the original lib.

    4. delete all the 8000 photos in the new.

    5. start put new photos in the photo library now empty iCloud.

    Is there a better way? I do it too difficult?

    I can see what I've described above taking a long time to settle on all devices, even if I can avoid 30 day waiting by removing the deleted record recently.

    Thank you

    You use "Optimize Mac Storage" on your Mac? Then, you will need to make sure that all the photos to download to your Mac before you copy your current library corresponding to your backup disk and start deleting iCloud.  Is there enough free storage on your Mac to do this?

    I would also like to than my thin iCloud library. My iCloud library has only my favorite photos of many years, I want on all my devices as well as the most recent photos that I'm still trying. Because the iCloud library must be the library system, only in iCloud library photos are available in the media for other applications browser, so I keep all the photos here that I can use in other applications.

    What I do to save bandwidth and download time is to have two libraries:

    1. A large library where I keep all the photos I want to keep - it's my photo archives. This library is on an external drive that is supported by Time Machine and is currently still an Aperture library.
    2. A smaller library iCloud in my pictures folder.

    I import new photos first to the iCloud library, remove all the bad moves that do not need archiving, then I export the originals at the library of the archives.

    And then I start editing the photos in the library to iCloud and learn by removing and keeping only the best photos.

  • Upgrading the BIOS on a Tecra M10 but without MS Windows

    Hello!

    My Tecra M10 runs OpenSolaris. No windows on this machine. Question is how upgraded the BIOS on this subject? The only file that I found to download is a Windows executable file...
    Another way? Such as the creation of a CD or a USB drive?

    Thanks in advance,
    Gilles gravel

    And what files you want to save on a CD or USB stick?
    Long since Toshiba doesn't offer traditional BIOS update but only the Win version.
    What you can try is to contact nearest Toshiba authorized maintainer and ask for help.

    They have access to the database of Toshiba and I imagine that they can help you with the update of the BIOS.
    You can also exchange of HDD, recovery of installation image, make sure BIOS update and put old HDD with solaris back. Maybe some friend of you HARD drive and you can borrow for this purpose.

  • My "auto download and install updates" is no longer 'auto' installs the updates. Now it downloads, but without installation

    Automatically download and install updates is set, it is not just to do the job.  I have literally click on install now for EVERY single update. I tried to put different time make this hope that would be "straighten" out there but... Thank you Ed M.

    Hey Ed M.

    1. you receive an error message or error code?

    2. the problem occurs with the individual update installation?

    I suggest to follow the article mentioned below and check to see if that does the trick:

     

    Solve common installation issues in Windows Update, Microsoft Update and Windows Server Update Services

    http://support.Microsoft.com/kb/906602

    Hope this information helps. Let us know if you encounter problems under Windows in the future. We will be happy to help you.

  • M3800 Precision how to create the system for windows recovery disc 7 without cd player

    Precision M3800 does not come with CD player. How can I create rescue disk to restore the system or system to go back to a restore point?

    Chris Chan

    CD/DVD media is a thing of the past, you must use Dell Backup and Recovery to a 16 GB Bootable USB Flash Drive:

    http://dellwindowsreinstallationguide.com/Dell-backup-and-recovery-1-8-1-71/

  • Help blackBerry Smartphones! the hidden files/pictures, tried to explore but without success!

    I created a few files containing images in my photo camera and selected so that these records be hidden. The images themselves of these hidden folders were always in my folder images in 'media' so I hid each image as well. I have read other suggestions to go explore and then selecting the option "Show hidden" and what I have hidden NOTHING will appear. Hidden folders do not appear, nor the individual hidden images. I've looked everywhere. Help, please! Thank you.

    Well, I tried to reproduce what you were doing. For me, it works exactly as it should:

    1. I created a folder on my map of media, called 'test '.
    2. I put a picture in this folder
    3. I hid the image
    4. I then hid the folder
    5. Without 'Show hidden', the folder does not appear
    6. With 'Show hidden', the folder will appear greyed out, and I can bring up its properties and display it
    7. Once the folder is not hidden, I can then navigate inside, then, seeing the photo file greyed, I can also display

    So I don't quite know why it does not work in your case... not my not adequately replicate what you did?

  • I recently bought a new Canon, downloaded an updated EOS and now Photoshop won't open my RAW images.  I tried several of the suggestions of others who seem to have the same problem but without success.

    Whenever I try to download an update it is said that it is not necessary.  I'm not as tech savvy as I noticed some of you all are but any help would be greatly appreciated.

    In photoshop cs6 go to help > about plug-in, click on the words of Camera Raw and see what version it says.

    If less than 8.8, try one of the linked below camera raw 9.1.1 installers then and I hope that your T6i files will open in photoshop cs6.

    Try this camera raw 9.1.1 installer

    http://swupdl.Adobe.com/updates/OOBE/aam20/win/PhotoshopCameraRaw7-7.0/9.1.88/Setup.zip

    or if it does not, this one under Camera Raw 9.1.1 installer:

    Camera Raw installation of Adobe Photoshop CC and CS6 program

  • I have Windows 7. It is not download the available updates. I tried changing the settings, but without success. Please fix this for me!

    I have windows 7 which is not download the available updates. I open windows update and changed several times. After checking the updates for several hours the system provides no updates, although indicates they are available. I'm having a problem in using the recovery feature in control because of this Panel. Please correct the deficiency.

    Post proposed by the facilitator for the appropriate forum placed

    Windows 7 update problems? First read this.

    :)

Maybe you are looking for

  • I have problem in my iPhone 6 more

    Hello, I bought a 6puls iphone's IMEI number *, where there are a lot of problem in the phone, are the following: -. -Camera -Touch screen -Do not control the constant phone The problem are many, this phone and I want to solve this problem, so I ask

  • Qosmio G30: blur its not clear with audio labs of cleaning

    I tried to use the software Audio Labs of cleaning on my laptop, but only you get very fuzzy not clear sound. Making my stereo in the computer laptop, software adapts catches three left hand and I'm not sure if (any) of them must be used.The micropho

  • display labels on the customization page

    I want to change the width of the display button not labels tab control page. Of course, I can add more control of the ring to this effect, but I want to know the technical in the customization of the control. However, I tried to replace the button w

  • HP 250 G2: Power password

    I lost the administrator password and after three attempt I get the message "System off" followed by code you 84458661, how can reset the password? THX in advance

  • 2329 internal error. 32, C:\config. Msi\7c6712. FBR

    I'm getting internal error 2329. 32, C:\config. Msi\7c6712. FBR to update my v Open Office 3.2 v 3.4.  I tried to uninstall OO all together with no will. I am operating Windows 7 Home Premium 64-bit. Any ideas? Thank you!