Dear Ugo: I have tried to create a new data object with a photo file and all works perfectly. My doubt is in relation to find it again and "export" it to a file again. I can find the data object without problems with the following snippet:
Dim PlantillaDatos As New CryptokiCollection
PlantillaDatos.Add(New ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_DATA))
PlantillaDatos.Add(New ObjectAttribute(ObjectAttribute.CKA_LABEL, "Foto"))
Dim Colecciónobjetos As CryptokiCollection, objeto As Object
Colecciónobjetos = sess.Objects.Find(PlantillaDatos, 10)
If Colecciónobjetos.Count > 0 Then
For Each objeto In Colecciónobjetos
MessageBox.Show(objeto.label) 'Show the label for the data object
'I create the file in my hard disk.
Dim s As FileStream = New FileStream("d:\temp\foto1.bmp", FileMode.Create)
?????????????????????????
s.Close()
Next
End If
I don´t know how to extract the byte array from the data object in order to create the file again in my hard disk.
Thank you very much in advanced.