Commit | Line | Data |
---|---|---|
c26fd69f DH |
1 | /* X.509 certificate parser internal definitions |
2 | * | |
3 | * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. | |
4 | * Written by David Howells (dhowells@redhat.com) | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public Licence | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the Licence, or (at your option) any later version. | |
10 | */ | |
11 | ||
57be4a78 | 12 | #include <linux/time.h> |
c26fd69f DH |
13 | #include <crypto/public_key.h> |
14 | ||
15 | struct x509_certificate { | |
16 | struct x509_certificate *next; | |
84aabd46 | 17 | struct x509_certificate *signer; /* Certificate that signed this one */ |
c26fd69f | 18 | struct public_key *pub; /* Public key details */ |
84aabd46 | 19 | struct public_key_signature sig; /* Signature parameters */ |
c26fd69f DH |
20 | char *issuer; /* Name of certificate issuer */ |
21 | char *subject; /* Name of certificate subject */ | |
46963b77 DH |
22 | struct asymmetric_key_id *id; /* Issuer + serial number */ |
23 | struct asymmetric_key_id *skid; /* Subject key identifier */ | |
24 | struct asymmetric_key_id *authority; /* Authority key identifier */ | |
a5752d11 DH |
25 | struct tm valid_from; |
26 | struct tm valid_to; | |
c26fd69f | 27 | const void *tbs; /* Signed data */ |
b426beb6 DH |
28 | unsigned tbs_size; /* Size of signed data */ |
29 | unsigned raw_sig_size; /* Size of sigature */ | |
30 | const void *raw_sig; /* Signature data */ | |
84aabd46 DH |
31 | const void *raw_serial; /* Raw serial number in ASN.1 */ |
32 | unsigned raw_serial_size; | |
33 | unsigned raw_issuer_size; | |
34 | const void *raw_issuer; /* Raw issuer name in ASN.1 */ | |
35 | const void *raw_subject; /* Raw subject name in ASN.1 */ | |
36 | unsigned raw_subject_size; | |
37 | unsigned index; | |
38 | bool seen; /* Infinite recursion prevention */ | |
39 | bool verified; | |
40 | bool trusted; | |
41559420 | 41 | bool unsupported_crypto; /* T if can't be verified due to missing crypto */ |
c26fd69f DH |
42 | }; |
43 | ||
44 | /* | |
45 | * x509_cert_parser.c | |
46 | */ | |
47 | extern void x509_free_certificate(struct x509_certificate *cert); | |
48 | extern struct x509_certificate *x509_cert_parse(const void *data, size_t datalen); | |
b426beb6 DH |
49 | |
50 | /* | |
51 | * x509_public_key.c | |
52 | */ | |
53 | extern int x509_get_sig_params(struct x509_certificate *cert); | |
54 | extern int x509_check_signature(const struct public_key *pub, | |
55 | struct x509_certificate *cert); |