TclPKCS11

Artifact [1a62948922]
Login

Artifact [1a62948922]

Artifact 1a62948922ed8ecc6c32939c3d8ad3a8b161ac2d60de4aa94a33e269325d10d1:

Wiki page [TclPKCS11] by rkeene on 2023-05-26 23:59:08.
D 2023-05-26T23:59:08.763
L TclPKCS11
N text/x-markdown
P 0b2f4c50ac87c08dec4e135ec6c29994b56c737a8892903271dd940d90fdc4a6
U rkeene
W 1770
# 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 separate 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.

This package lets Tcl scripts interface with PKCS#11 modules.

This package requires the "pki" extension, which is pure Tcl and can be
found in Tcllib.

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 (**0.9.14**)
      * [Source Tarball](/uv/releases/tclpkcs11-0.9.14.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"
Z f195cfbde576e770cef3848998b203a3