Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Cipher.unwrap

Reply
Thread Tools

Cipher.unwrap

 
 
Gary
Guest
Posts: n/a
 
      08-08-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments