fix one too small
[RRG-proxmark3.git] / client / src / emv / emv_pk.h
blob83628bbc2ca328a21a2fe777b74b9b66ed25c8b0
1 //-----------------------------------------------------------------------------
2 // Borrowed initially from https://github.com/lumag/emv-tools/
3 // Copyright (C) 2012, 2015 Dmitry Eremin-Solenikov
4 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
11 // This program 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
14 // GNU General Public License for more details.
16 // See LICENSE.txt for the text of the license.
17 //-----------------------------------------------------------------------------
18 // libopenemv - a library to work with EMV family of smart cards
19 //-----------------------------------------------------------------------------
21 #ifndef EMV_PK_H
22 #define EMV_PK_H
24 #include "common.h"
26 struct emv_pk {
27 unsigned char rid[5];
28 unsigned char index;
29 unsigned char serial[3];
30 unsigned char pan[10];
31 unsigned char hash_algo;
32 unsigned char pk_algo;
33 unsigned char hash[20];
34 unsigned char exp[3];
35 size_t elen;
36 size_t mlen;
37 unsigned char *modulus;
38 unsigned int expire;
41 #define EXPIRE(yy, mm, dd) 0x ## yy ## mm ## dd
43 struct emv_pk *emv_pk_parse_pk(char *buf, size_t buflen);
44 struct emv_pk *emv_pk_new(size_t modlen, size_t explen);
45 void emv_pk_free(struct emv_pk *pk);
46 char *emv_pk_dump_pk(const struct emv_pk *pk);
47 bool emv_pk_verify(const struct emv_pk *pk);
49 char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsigned char idx);
50 char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid);
51 struct emv_pk *emv_pk_get_ca_pk(const unsigned char *rid, unsigned char idx);
52 #endif