]> git.zerfleddert.de Git - proxmark3-svn/blob - client/emv/emv_pk.h
"hf mf ekeyprn d" doesn't works properly (#904)
[proxmark3-svn] / client / emv / emv_pk.h
1 /*
2 * libopenemv - a library to work with EMV family of smart cards
3 * Copyright (C) 2015 Dmitry Eremin-Solenikov
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 */
15
16 #ifndef EMV_PK_H
17 #define EMV_PK_H
18
19 #include <stdbool.h>
20 #include <stddef.h>
21
22 struct emv_pk {
23 unsigned char rid[5];
24 unsigned char index;
25 unsigned char serial[3];
26 unsigned char pan[10];
27 unsigned char hash_algo;
28 unsigned char pk_algo;
29 unsigned char hash[20];
30 unsigned char exp[3];
31 size_t elen;
32 size_t mlen;
33 unsigned char *modulus;
34 unsigned int expire;
35 };
36
37 #define EXPIRE(yy, mm, dd) 0x ## yy ## mm ## dd
38
39 struct emv_pk *emv_pk_parse_pk(char *buf);
40 struct emv_pk *emv_pk_new(size_t modlen, size_t explen);
41 void emv_pk_free(struct emv_pk *pk);
42 char *emv_pk_dump_pk(const struct emv_pk *pk);
43 bool emv_pk_verify(const struct emv_pk *pk);
44
45 char *emv_pk_get_ca_pk_file(const char *dirname, const unsigned char *rid, unsigned char idx);
46 char *emv_pk_get_ca_pk_rid_file(const char *dirname, const unsigned char *rid);
47 struct emv_pk *emv_pk_get_ca_pk(const unsigned char *rid, unsigned char idx);
48 #endif
Impressum, Datenschutz