Sha256: 8d2432a13f71d6b72d9c84c55c1a27d1d303723b48277f13653a743e72b441e9

Contents?: true

Size: 842 Bytes

Versions: 6

Compression:

Stored size: 842 Bytes

Contents

require "test/unit"
require "pkcs11"
require "test/helper"

class TestPkcs11 < Test::Unit::TestCase
  def setup
    @pk = open_softokn
  end

  def teardown
    @pk.close
    @pk = nil
    GC.start
  end

  def pk
    @pk
  end
  
  def test_info
    info = pk.info
    assert info.inspect =~ /cryptokiVersion=/, 'There should be a version in the library info'
  end

  def test_slots
    slots = pk.active_slots
    assert slots.length>=1, 'Hope there is at least one active slot'
  end

  def test_close
    pk.close
    pk.unload_library
    assert_raise(PKCS11::Error){ pk.info }

    @pk = PKCS11.open
    pk.load_library(find_softokn)
    
    pk.C_GetFunctionList
    
    pargs = PKCS11::CK_C_INITIALIZE_ARGS.new
    pargs.flags = 0
    pargs.pReserved = softokn_params.join(" ")
    pk.C_Initialize(pargs)
    
    pk.info
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pkcs11-0.2.1-x86-mswin32 test/test_pkcs11.rb
pkcs11-0.2.1-x86-mingw32 test/test_pkcs11.rb
pkcs11-0.2.1 test/test_pkcs11.rb
pkcs11-0.2.0-x86-mswin32 test/test_pkcs11.rb
pkcs11-0.2.0-x86-mingw32 test/test_pkcs11.rb
pkcs11-0.2.0 test/test_pkcs11.rb