source: terepaima/terepaima-0.4.16/sources/smartCardFunc.cpp

stretch
Last change on this file was 35bdadc, checked in by pbuitrago@…>, 6 years ago

Se agregaron las librerias necesarias para la gestion de dispositivos criptograficos y se modifico mainwindow.cpp y mainwindow.h para la gestion de los dispositivos criptograficos

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/***************************************************************************
2                          smartCard.cpp  -  description
3                             -------------------
4    begin                : vie sep 24 2004
5    copyright            : (C) 2004 by Antonio Araujo,
6                                       Victor Bravo
7                                       Jorge Redondo
8 
9    email                : antonioaraujo@funmrd.gov.ve
10                           victorb@funmrd.gov.ve
11                           redondo@funmrd.gov.ve
12 ***************************************************************************/
13
14/***************************************************************************
15 *                                                                         *
16 *   This program is free software; you can redistribute it and/or modify  *
17 *   it under the terms of the GNU General Public License as published by  *
18 *   the Free Software Foundation; either version 2 of the License, or     *
19 *   (at your option) any later version.                                   *
20 *                                                                         *
21 ***************************************************************************/
22 
23 
24#include "smartCardFunc.h"
25 
26
27
28// convierte el formato biginteger_t PKCS#11 a BIGNUM OpenSSL
29// "to" deberia ser la direccion de un puntero inicializado en NULL para
30// recibir el BIGNUM. por ejemplo:
31//      biginteger_t    from;
32//      BIGNUM  *foo = NULL;
33//      cvt_bigint2bn(&from, &foo);
34
35//static
36int cvt_bigint2bn(biginteger_t *from, BIGNUM **to)
37{
38        BIGNUM  *temp = NULL;
39        printf("\n");
40        printf("inside cvt_bigint2bn\n");
41
42        int i;
43        printf("modulus: ");
44        for (i=0; i < (int)from->big_value_len; i++) 
45        {
46                printf("%02X ", from->big_value[i]);           
47        }
48        printf("\n");
49       
50       
51        if (from == NULL || to == NULL)
52                return (-1);
53               
54        printf("\ncalling BN_bin2bn\n");
55        temp = BN_bin2bn((const unsigned char *)from->big_value, (int)from->big_value_len, *to);
56       
57        //printf("verifica if (temp == NULL)\n");
58        if (temp == NULL)
59        {
60                printf("temp == NULL\n");       
61                return (-1);
62        }
63        *to = temp;
64        return (0);
65}
66
67// funcion para copiar una plantilla de atributos a un biginteger_t
68void copy_attr_to_bigint(CK_ATTRIBUTE_PTR attr, biginteger_t *big)
69{
70        printf("copy_attr_to_bigint\n");
71       
72        big->big_value = (CK_BYTE *) attr->pValue;
73        printf("big->big_value = (CK_BYTE *) attr->pValue\n");
74       
75        big->big_value_len = (CK_ULONG) attr->ulValueLen;
76        printf("big->big_value_len = (CK_ULONG) attr->ulValueLen\n");
77}
78
79
80
81
82
83
84
85
86
87
88
89
90
Note: See TracBrowser for help on using the repository browser.