Security code - need some help with key unwrapping

J

JPractitioner

Hi all,

i need to unwrap a key(keyX), using another key (keyY)

keyY is stored in a HSM simulator

i reach to keyY by doing the following
..
..
..
KeyStore keyStore = KeyStore.getInstance("CRYPTOKI", provider.getName
());
keyStore.load(null, password.toCharArray());
Key keyY = keyStore.getKey("myKeyY", null);

now suppose keyX = "F81CF8A4A81962C1"


i manage to do the unwraping code like the followings...

String keyX = "F81CF8A4A81962C1";
byte[] b = keyX.getBytes();

WrappingKeyStore wrapKeyStore = WrappingKeyStore.getInstance
("CRYPTOKI", provider.getName());
Key uk = wrapKeyStore.unwrapKey(k,transformation,b,"DESede");

but i get this error

CryptokiError: 0x13 attribute value invalid

any idea?

TIA
 
R

Roedy Green

CryptokiError: 0x13 attribute value invalid

Plugins are notorious. Nothing is documented. It is never clear what
is optional.

x13 is a Cr. Try trimming and Strings before you feed them into your
black box.

If that does not work, look at the stack trace to find the code that
was checking something at the time it threw the exception. As least
you might figure out which parm it was complaining about.

Sun could save so much frustration with a little cook book essay
showing you how to USE JCE to accomplish each of the standard things
you might do with each of the methods.


--
Roedy Green Canadian Mind Products
http://mindprod.com

"Think of the earth as a living organism that is being attacked by billions of bacteria whose numbers double every forty years. Either the host dies, or the virus dies, or both die."
~ Gore Vidal
 
D

DC

x13 is not a CR, it is ASCII 19(10), which is DC3, which in this
instance is some sort of error code.

i see..
thanks to the both of you, I just realized the exception was thrown by
the third party library. I shouldn't be asking here but the points you
guys gave do make sense, thanks ya
 
D

DC

x13 is not a CR, it is ASCII 19(10), which is DC3, which in this
instance is some sort of error code.

i see..
thanks to the both of you, I just realized the exception was thrown by
the third party library. I shouldn't be asking here but the points you
guys gave do make sense, thanks ya
 
D

DC

x13 is not a CR, it is ASCII 19(10), which is DC3, which in this
instance is some sort of error code.

i see..
thanks to the both of you, I just realized the exception was thrown by
the third party library. I shouldn't be asking here but the points you
guys gave do make sense, thanks ya
 
R

Roedy Green

x13 is not a CR, it is ASCII 19(10), which is DC3, which in this
instance is some sort of error code.

oops. decimal 13 hex 0D is CR. 10 hex 0A is LF.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"At this point, 29 percent of fish and seafood species have collapsed - that is,
their catch has declined by 90 percent. It is a very clear trend, and it is accelerating.
If the long-term trend continues, all fish and seafood species are projected to collapse
within my lifetime -- by 2048."
~ Dr. Boris Worm of Dalhousie University
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top