TclPKCS11

Changes To TclPKCS11
Login

Changes To TclPKCS11

Initial version of "TclPKCS11"











































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# RSA's Public Key Cryptographic Standard (PKCS) #11 for Tcl
## Introduction

Public Key Cryptography Standard (PKCS) Number 11 specifies an API for interfacing with cryptographic tokens.  These cryptographic tokens are usually seperate hardware devices that do not provide direct access to the keying materials under normal use -- instead they directly perform the cryptographic operations on the hardware module.  This provides additional security and can be used for off-loading CPU intensive operations to specialized hardware.

Some PKCS#11 providers:

   * [CACKey](https://cackey.rkeene.org/)
   * [CoolKey](http://directory.fedoraproject.org/wiki/CoolKey)
   * [OpenSC](http://www.opensc-project.org/opensc)

## Downloads

   * [Latest Release](/uv/releases/tclpkcs11-0.9.12.tar.gz)
   * [Archive](/uvlist)

## Information

  * [Usage](/doc/trunk/usage.txt)

## Simple Example

        package require pki
        package require pki::pkcs11
        
        set handle [pki::pkcs11::loadmodule /usr/lib/pkcs11/libcackey.so]
        
        pki::pkcs11::login $handle $slotId 123456
        
        set slots [pki::pkcs11::listslots $handle]
        set slotId [lindex $slots 0 0]
        
        set certs [pki::pkcs11::listcerts $handle $slotId]
        set cert [lindex $certs 0]
        
        set plain "TestMsg"
        
        set cipher [pki::encrypt -binary -pub -- $plain $cert]
        set check  [pki::decrypt -binary -priv -- $cipher $cert]
        
        puts "Plain: $plain"
        puts "Check: $check"