<link>http://www.ncryptoki.com/forum.aspx</link> <description /> <docs>http://www.rssboard.org/rss-specification</docs> <generator>mojoPortal Forum module</generator> <item> <title>Re: Search a data object and read its content Ugo, I´m very sorry, but I found the solution to my own question. I have to use Data Class. Thank you very much.

]]>
http://www.ncryptoki.com/Forums/Thread.aspx?pageid=9&t=26~-1#post135 fcirera http://www.ncryptoki.com/Forums/Thread.aspx?pageid= Tue, 10 May 2011 10:36:54 GMT Search a data object and read its content 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.

]]>
http://www.ncryptoki.com/Forums/Thread.aspx?pageid=9&t=26~-1#post134 fcirera http://www.ncryptoki.com/Forums/Thread.aspx?pageid= Tue, 10 May 2011 10:12:34 GMT