<link>http://ncryptoki.com/forum.aspx</link> <description /> <docs>http://www.rssboard.org/rss-specification</docs> <generator>mojoPortal Forum module</generator> <item> <title>Re: license problem You should set the license in the Sub Main as you did:

Cryptoki.Licensee = "  "
Cryptoki.ProductKey = "  "

 

You can put the rest of the code where you want, in any function as you want.

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=316~-1#post1119 kkc http://ncryptoki.com/Forums/Thread.aspx?pageid= Tue, 25 Jul 2017 13:53:04 GMT Re: license problem  Public Sub Main()

        Dim cryptoki As Cryptoki
        Dim tokenslots As SlotList
        Dim token As Token
        Dim session As Session
        Cryptoki.Licensee = "  "
        Cryptoki.ProductKey = "  "

        ' Creates a Cryptoki object related to the specific PKCS#11 native library
        cryptoki = New Cryptoki("c:\Program Files\SafeNet\LunaClient\cryptoki.dll")

        cryptoki.Initialize()

        'Prints all information relating to the native library

        ' Reads the set of slots containing a token
        tokenslots = cryptoki.ActiveSlots
        If (tokenslots.Count = 0) Then Throw New Exception("No token inserted")

        ' Gets the first token available
        token = tokenslots(0).Token

        ' Opens a read/write serial session
        session = token.OpenSession((Session.CKF_SERIAL_SESSION Or Session.CKF_RW_SESSION), Nothing, Nothing)

    End Sub 'Main

 

If I set these code under the  Public Sub Main(), it won't give me any error. If I set in the Public Class MainForm, the code won't working. But I have to set in the Public Class MainForm. What is the problem here?

 

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=316~-1#post1118 kkc http://ncryptoki.com/Forums/Thread.aspx?pageid= Mon, 24 Jul 2017 14:44:37 GMT
Re: license problem Hi Ugo,

I read your Cryptoki class, the instructor is

"  Public Sub New()    and  Public Sub New(cryptokilib As String)"

I have to set instanciation of Cryptoki class, then set the Licensee value. How can I set the license before any instanciation of Cryptoki class?

do you have any example code? Thank you.

namespace Cryptware.NCryptoki
   
    <ClassInterface(ClassInterfaceType.AutoDual)> <ComVisible(True)> <Guid("7EC26C78-4297-43e0-BDBC-5477362D8C53")>
    Public Class Cryptoki
        Implements ICryptoki

   
        Public Const CKF_DONT_BLOCK As Integer = 1
        Public Sub New()
        Public Sub New(cryptokilib As String)


        Public Shared Property Licensee As String  
        Public Shared Property ProductKey As String      
        Public ReadOnly Property ActiveSlots As SlotList 
        Public ReadOnly Property AttachedCryptokiLib As String   
        Public ReadOnly Property Info As CryptokiInfo  
        Public ReadOnly Property Slots As SlotList

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=316~-1#post1117 kkc http://ncryptoki.com/Forums/Thread.aspx?pageid= Mon, 24 Jul 2017 13:21:34 GMT
Re: license problem Your code is wrong

You call:

Dim Cryptoki = New Cryptoki("c:\Program Files\SafeNet\LunaClient\cryptoki.dll")

and later 

Cryptoki.Licensee = "...my Licensee..."
Cryptoki.ProductKey = "...my ProductKey"

The license message appears when you call the first one

You must set the license before any instanciation of Cryptoki class, i.e. before:

Dim Cryptoki = New Cryptoki("c:\Program Files\SafeNet\LunaClient\cryptoki.dll")

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=316~-1#post1116 kkc http://ncryptoki.com/Forums/Thread.aspx?pageid= Fri, 21 Jul 2017 15:33:10 GMT
Re: license problem Hi Ugo,

I set the license codes once at the beginning of my program, and my code as follows:

 

Public Class MainForm


    Dim tokenslots As SlotList
    Dim token As Token
    Dim session As Session
    Dim Cryptoki = New Cryptoki("c:\Program Files\SafeNet\LunaClient\cryptoki.dll")
    Dim res As Integer


    Dim pgp As String = ""
    Dim strSource As String = ""
    Dim strLog As String = "Application"
    Dim strMachine As String = "."
    Public myEventLog As EventLog = New EventLog(strLog, strMachine, strSource)
    Public expiryDates As New Collection
    Public confFilePresent As Boolean = False


    Cryptoki.Licensee = "...my Licensee..."
    Cryptoki.ProductKey = "...my ProductKey"

    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

these two lines
    Cryptoki.Licensee = "...my Licensee..."
    Cryptoki.ProductKey = "...my ProductKey"

show error on Cryptoki, and if I add these in the MainForm_Load, the error disappear but when I run the code, the notice"This version of NCryptoki is not licensed" is coming. What is the problem here? Thank you.

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=316~-1#post1115 kkc http://ncryptoki.com/Forums/Thread.aspx?pageid= Fri, 21 Jul 2017 14:21:56 GMT
Re: license problem You should set the license codes once at the beginning of your program and that's all

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=316~-1#post1114 kkc http://ncryptoki.com/Forums/Thread.aspx?pageid= Thu, 20 Jul 2017 19:57:09 GMT
license problem Hi Ugo,

I follow your license installation, and add Cryptoki.Licensee = "Licensee"; Cryptoki.ProductKey = "ProductKey" to my application. When I test it in your VB sample code,it's working, but if I add these code to my Console Application it's not working and alway notice"This version of NCryptoki is not licensed". What is the problem here?

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=316~-1#post1113 kkc http://ncryptoki.com/Forums/Thread.aspx?pageid= Thu, 20 Jul 2017 19:06:27 GMT