Wrap Key Problem

2/24/2012 10:57:25 AM
Gravatar
Total Posts 3

Wrap Key Problem

Dear.
   hi, I use a DES key to Wrap another DES key like this:

            Mechanism mech = new Mechanism(Mechanism.CKM_DES_ECB, null);
            try
            {
                byte[] wrapped_key = session.WrapKey(mech, des_k2, des_k1);
            }
            catch (CryptokiException e)
            {
                string error = e.ErrorString;
                int errorcode = e.ErrorCode;
                Console.WriteLine("ErrorCode: 0x{0:X8} "+error,errorcode);
            }

   but I get MECHANISM_INVALID error, what's the problem?

2/27/2012 4:49:16 PM
Gravatar
Total Posts 300
Ugo Chirico http://www.ugochirico.com

Re: Wrap Key Problem

Are you sure that you underlying PKCS#11 dll supports the mechanism CKM_DES_ECB?

2/28/2012 4:32:16 AM
Gravatar
Total Posts 3

Re: Wrap Key Problem

Yes,sure.Because I can use CKM_DES_ECB to Encrypt data.Is there any example to use Wrap key and Unwrap Key?

 

Thanks !

2/28/2012 5:00:30 AM
Gravatar
Total Posts 3

Re: Wrap Key Problem

Above all,how do i know my token support the wrap/unwrap funciton or any other function?

 

Thanks!

3/2/2012 1:57:52 PM
Gravatar
Total Posts 22

Re: Wrap Key Problem

Above all,how do i know my token support the wrap/unwrap funciton or any other function?

Thanks!

This should be in your token documentation.