x509_parser.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #include <linux/time.h>
  12. #include <crypto/public_key.h>
  13. struct x509_certificate {
  14. struct x509_certificate *next;
  15. struct public_key *pub; /* Public key details */
  16. char *issuer; /* Name of certificate issuer */
  17. char *subject; /* Name of certificate subject */
  18. char *fingerprint; /* Key fingerprint as hex */
  19. char *authority; /* Authority key fingerprint as hex */
  20. struct tm valid_from;
  21. struct tm valid_to;
  22. const void *tbs; /* Signed data */
  23. unsigned tbs_size; /* Size of signed data */
  24. unsigned raw_sig_size; /* Size of sigature */
  25. const void *raw_sig; /* Signature data */
  26. struct public_key_signature sig; /* Signature parameters */
  27. };
  28. /*
  29. * x509_cert_parser.c
  30. */
  31. extern void x509_free_certificate(struct x509_certificate *cert);
  32. extern struct x509_certificate *x509_cert_parse(const void *data, size_t datalen);
  33. /*
  34. * x509_public_key.c
  35. */
  36. extern int x509_get_sig_params(struct x509_certificate *cert);
  37. extern int x509_check_signature(const struct public_key *pub,
  38. struct x509_certificate *cert);