David Howells | c26fd69 | 2012-09-24 17:11:48 +0100 | [diff] [blame] | 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 | |
David Howells | 57be4a7 | 2013-08-30 16:16:34 +0100 | [diff] [blame] | 12 | #include <linux/time.h> |
David Howells | c26fd69 | 2012-09-24 17:11:48 +0100 | [diff] [blame] | 13 | #include <crypto/public_key.h> |
| 14 | |
| 15 | struct x509_certificate { |
| 16 | struct x509_certificate *next; |
| 17 | struct public_key *pub; /* Public key details */ |
| 18 | char *issuer; /* Name of certificate issuer */ |
| 19 | char *subject; /* Name of certificate subject */ |
| 20 | char *fingerprint; /* Key fingerprint as hex */ |
| 21 | char *authority; /* Authority key fingerprint as hex */ |
David Howells | a5752d1 | 2012-10-02 14:36:16 +0100 | [diff] [blame] | 22 | struct tm valid_from; |
| 23 | struct tm valid_to; |
David Howells | c26fd69 | 2012-09-24 17:11:48 +0100 | [diff] [blame] | 24 | const void *tbs; /* Signed data */ |
David Howells | b426beb | 2013-08-30 16:18:02 +0100 | [diff] [blame] | 25 | unsigned tbs_size; /* Size of signed data */ |
| 26 | unsigned raw_sig_size; /* Size of sigature */ |
| 27 | const void *raw_sig; /* Signature data */ |
| 28 | struct public_key_signature sig; /* Signature parameters */ |
David Howells | c26fd69 | 2012-09-24 17:11:48 +0100 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | /* |
| 32 | * x509_cert_parser.c |
| 33 | */ |
| 34 | extern void x509_free_certificate(struct x509_certificate *cert); |
| 35 | extern struct x509_certificate *x509_cert_parse(const void *data, size_t datalen); |
David Howells | b426beb | 2013-08-30 16:18:02 +0100 | [diff] [blame] | 36 | |
| 37 | /* |
| 38 | * x509_public_key.c |
| 39 | */ |
| 40 | extern int x509_get_sig_params(struct x509_certificate *cert); |
| 41 | extern int x509_check_signature(const struct public_key *pub, |
| 42 | struct x509_certificate *cert); |