root/pykcs11/trunk/samples/unblock.py

Revision 49, 1.0 kB (checked in by lrousseau, 2 years ago)

sample code to unblock a PIN

  • Property svn:executable set to *
Line 
1 #!/usr/bin/env python
2
3 #   Copyright (C) 2006 Ludovic Rousseau <ludovic.rousseau@free.fr>
4 #
5 # This file is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18
19 import PyKCS11
20
21 pin="1234"
22 puk="1234"
23
24 pkcs11 = PyKCS11.PyKCS11Lib()
25 pkcs11.load()
26 slot = pkcs11.getSlotList()[0]
27 session = pkcs11.openSession(slot, PyKCS11.CKF_RW_SESSION)
28 session.login(puk, PyKCS11.CKU_SO)
29 session.initPin(pin)
30 session.logout()
31 session.closeSession()
Note: See TracBrowser for help on using the browser.
(C) 2006 bit4id srl, for informations please contact info@bit4id.com
visitors since August 21, 2006