Giter Club home page Giter Club logo

pkcs11-proxy's Introduction

PKCS11-Proxy is a proxy for the PKCS11-library.

This project is based on a stripped down Gnome Keyring without all gnome dependencies and other features.

The proxy tunnels PKCS11-requests over the network. One possible use is to store cryptograhic information on a seperate server. This way the crypto it can be isolated from the rest of the system. Beware: the connection is not encrypted and can easily be sniffed. You should use a secure communication-channel, for example stunnel.

Here is an example of using pkcs11-proxy together with SoftHSM (from the OpenDNSSEC project). The benefit of this setup is that no extra hardware is needed at all. This could also be considered the greatest weakeness. For demonstration purposes, however, security is not a consideration.

$ sudo adduser cgielen pkcs11
$ sudo adduser cgielen softhsm

$ softhsm --init-token --slot 0 --label test
The SO PIN must have a length between 4 and 255 characters.
Enter SO PIN:
The user PIN must have a length between 4 and 255 characters.
Enter user PIN:
The token has been initialized.

$ PKCS11_DAEMON_SOCKET="tcp://127.0.0.1:2345" pkcs11-daemon /usr/lib/libsofthsm.so
$ PKCS11_PROXY_SOCKET="tcp://127.0.0.1:2345" pkcs11-tool --module=/usr/lib/libpkcs11-proxy.so -L Available
slots: Slot 0           SoftHSM
  token label:   test token manuf:   SoftHSM token model:   SoftHSM
  token flags:   rng, login required, PIN initialized, token initialized,
  other flags=0x40 serial num  :  1

Another implementation can be found at https://github.com/hajikhorasani/cryptokimpx

pkcs11-proxy's People

Contributors

iksaif avatar

Stargazers

 avatar  avatar  avatar  avatar jackal avatar morteza ataiy avatar Orson Wang avatar Valeriy Sotnikov avatar Lucas Fernando Amorim avatar Csoban Kesmarki avatar David Lakatos avatar Omer YILDIZ avatar Or Noyman avatar  avatar Daniel Law avatar Szczepan Zalega avatar  avatar  avatar  avatar

Watchers

Dane Foster avatar James Cloos avatar  avatar  avatar  avatar

pkcs11-proxy's Issues

Erreur sur le FindObject

Dans le cadre d'une mission dans un ministère, on utilise cette lib pour un projet open source. On l'utilise aujourd'hui pour simuler un HSM dans des containeurs docker via softhsm.

Depuis peu, on souhaite l'utiliser pour taper sur un HSM sur les env de DEV. Cette bibliothèque est très utile pour faire du remote debug depuis nos postes (Windows).

La communication se fait bien entre le daemon (sous linux) et le proxy (windows). Les informations sur le slot, l'init d'une session, pas de problème :

Listening on: 0.0.0.0:80

New session 2433-16039

DEBUG: C_Initialize: enter
DEBUG: ret: 0
DEBUG: C_GetInfo: enter
DEBUG: ret: 0
...

Cependant, on rencontre des problèmes lors de l'utilisation du FindObject:
Au niveau du daemon :
DEBUG: C_FindObjectsInit: enter
DEBUG: ret: 19

Le détail de la commande via p11-spy :

****************************** 2021-01-12 14:44:40 ***
0x00003d6c : 0x00002994 : Calling C_FindObjectsInit
0x00003d6c : 0x00002994 : Input
0x00003d6c : 0x00002994 :  hSession: 16777217
0x00003d6c : 0x00002994 :  pTemplate: 000001F2626EF3F0
0x00003d6c : 0x00002994 :  ulCount: 1
0x00003d6c : 0x00002994 :   *** Begin attribute template ***
0x00003d6c : 0x00002994 :   Attribute 0
0x00003d6c : 0x00002994 :    Attribute: 0 (CKA_CLASS)
0x00003d6c : 0x00002994 :    pValue: 000001F2624DEFF0
0x00003d6c : 0x00002994 :    ulValueLen: 4
0x00003d6c : 0x00002994 :    *pValue: HEX(06000000)
0x00003d6c : 0x00002994 :   *** End attribute template ***
0x00003d6c : 0x00002994 : Returning 19 (CKR_ATTRIBUTE_VALUE_INVALID)

auriez vous une idée ? merci.

Add GitHub Action that produces win32 builds

Hi!

It seems this has support for Windows? It would be great if it were possible to have a GitHub Action that built the win32 build every week or so to have fresh builds available for download for non-dev Windows users/machines.

(And to check while I'm here, this would allow me to forward a PIV-smartcard from Windws to my remote Linux devbox?)

Segmentation fault using AES GCM and SoftHSMv2

We're trying to use this proxy (thanks for the work!) together with SoftHSMv2 and Graphene to encrypt using AES GCM. We started by patching the following files to allow for AES GCM support:

However, that yields a segfault in libsofthsm2.so at this spot. Probably it's the access of CK_GCM_PARAMS_PTR(pMechanism->pParameter)->pIv that's failing here.

Judging from the implementation we're calling C_EncryptInit with the following mechanism parameters:

{ 
  iv: <Buffer 31 32 33 34 35 36 37 38 39 30 31 32>, // that's 123456789012 in UTF-8
  ivBits: 128,
  ivLen: 12,
  aad: <Buffer >,
  aadLen: 0,
  tagBits: 128,
}

Can you/somebody give any advice or help on how we can fix or at least debug this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.