1 | /* |
---|
2 | * Estonian ID card plugin for web browsers |
---|
3 | * |
---|
4 | * Copyright (C) 2010-2011 Codeborne <info@codeborne.com> |
---|
5 | * |
---|
6 | * This is free software; you can redistribute it and/or |
---|
7 | * modify it under the terms of the GNU Lesser General Public |
---|
8 | * License as published by the Free Software Foundation; either |
---|
9 | * version 2.1 of the License, or (at your option) any later version. |
---|
10 | * |
---|
11 | * This software is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | * Lesser General Public License for more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU Lesser General Public |
---|
17 | * License along with this library; if not, write to the Free Software |
---|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
---|
19 | * |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef __ESTEID_SIGN__ |
---|
23 | #define __ESTEID_SIGN__ |
---|
24 | |
---|
25 | #include "esteid_certinfo.h" |
---|
26 | |
---|
27 | typedef struct { |
---|
28 | char *(*promptFunction)(void *, const char *, const char *, unsigned, int); |
---|
29 | void (*alertFunction)(void *, const char *); |
---|
30 | void *nativeWindowHandle; |
---|
31 | char *pin2; |
---|
32 | } EstEID_PINPromptData; |
---|
33 | |
---|
34 | typedef struct { |
---|
35 | CK_SESSION_HANDLE session; |
---|
36 | CK_RV result; |
---|
37 | } EstEID_PINPadThreadData; |
---|
38 | |
---|
39 | #ifdef _WIN32 |
---|
40 | typedef struct { |
---|
41 | EstEID_PINPromptData pinPromptData; |
---|
42 | char* name; |
---|
43 | char* message; |
---|
44 | unsigned int minPin2Length; |
---|
45 | } EstEID_PINPromptDataEx; |
---|
46 | #endif |
---|
47 | |
---|
48 | int EstEID_signHashHex(char **signatureHex, CK_SLOT_ID slotID, EstEID_Map cert, const char *hashHex, EstEID_PINPromptData pinPromptData); |
---|
49 | |
---|
50 | char *EstEID_sign(char *cn, char *hash, EstEID_PINPromptData pinPrompt); |
---|
51 | |
---|
52 | int EstEID_getRemainingTries(CK_SLOT_ID slotID); |
---|
53 | |
---|
54 | int EstEID_findNonRepuditionCert(EstEID_Certs *certs, const char *certId); |
---|
55 | |
---|
56 | char* EstEID_getFullNameWithPersonalCode(EstEID_Map cert); |
---|
57 | |
---|
58 | int EstEID_isPinPad(CK_SLOT_ID slotID); |
---|
59 | |
---|
60 | int EstEID_getSlotId(char* certId, CK_SLOT_ID* slotId); |
---|
61 | |
---|
62 | char *EstEID_hex2bin(const char *hex); |
---|
63 | |
---|
64 | #endif |
---|