set_attribute method

7/13/2013 9:56:43 AM
Gravatar
Total Posts 7

set_attribute method

hi 

how can i use set_attribute function by ncryptoki? i.e i have a handle for a key (by find method) then i want to change it's attribute (i want to set wrapping attribute) but i don't know how i can do it??

another question i have :  i have a handle for a key and an array contains output of session.WrapKey() method , now i want decrypt the wrapped key to get the value of key .should i use decryptinit  and decrtyp sequently?

this is a piece  my code if it isn't correct help me pls

 CryptokiCollection objects = session.Objects.Find(template, 1);
             Key key1_handle = (PrivateKey) objects[0];
            byte[] k1enck1 = session.WrapKey(Mechanism.AES_MAC,key1_handle, key1_handle);
            session.DecryptInit(Mechanism.AES_MAC,key1_handle);

                       byte[] k1 = session.Decrypt(k1enck1);