Cipher.unwrap

Discussion in 'Java' started by Gary, Aug 8, 2003.

  1. Gary

    Gary Guest

    I am trying to find a way to use the wrap/unwrap methods in
    javax.crypto

    I can wrap a key without any trouble, but I cannot unwrap a key
    afterwards. The Cipher object must be initialized beforehand with a
    key object, which I don't have because I have to unwrap it first.

    I tried using a SecretKeySpec in placec as in:

    SecretKeySpec skeySpec = new SecretKeySpec( rawBytes, "AES");
    Cipher cipher = Cipher.getInstance( "AES");
    cipher.init( Cipher.UNWRAP_MODE, skeySpec);

    but it gives me an Exception line:
    java.lang.SecurityException: Unsupported keysize or algorithm
    parameters

    I believe the key size is right, so I guess it must be the algorithm
    parameters. Am I close here?

    I know I can serialize the key in order to save it to disk, but I
    wanted to see if it is possible to use the wrapping mechanism, first.

    I have seen that there is a bug report on the Java website, but I
    can't tell if that is a bug in the implementaion, or the
    documentation. Also, I can't find anywhere if or when they plan on
    fixing the bug.

    Has anyone heard of this, and have you found a direct solution?

    Thanks for your help
    Gary, Aug 8, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ahmed Moustafa
    Replies:
    0
    Views:
    764
    Ahmed Moustafa
    Nov 15, 2003
  2. terry

    Cipher jpeg stream

    terry, Jul 31, 2004, in forum: Java
    Replies:
    1
    Views:
    646
  3. Greg Ewing

    Python COM: Automatic wrap/unwrap?

    Greg Ewing, Nov 8, 2008, in forum: Python
    Replies:
    4
    Views:
    287
    Paul Rudin
    Nov 10, 2008
  4. vunet
    Replies:
    0
    Views:
    1,618
    vunet
    Mar 3, 2009
  5. sdeveloper11
    Replies:
    0
    Views:
    477
    sdeveloper11
    Mar 29, 2011
Loading...

Share This Page