Commit Graph

16 Commits

Author SHA1 Message Date
Nicolas Williams
be0d1e68e5 hx509: Add support for CSRs w/ BasicConstraints 2023-11-08 14:22:02 -06:00
Nicolas Williams
0d5b238186 hx509: PKCS#12 missing error check 2022-11-22 11:34:54 -05:00
Nicolas Williams
bc9054d4b5 hx509: Better handle OpenSSL diffs in test_req 2019-12-20 16:14:00 -06:00
Nicolas Williams
a7a1d798c3 hx509: keep track of authorized CSR features
This commit adds a few functions for marking KU, EKUs, and SANs as
authorized, and for getting a count of unsupported certificate
extensions requested, and a count of authorized KU/EKUs/SANs.

The intent is to make it easier to build CSR authorization and CA code
that is robust in the face of future support for certificate extensions
and SAN types not currently supported.  An application could parse a
CSR, iterate all KU/EKUs/SANs, check a subject's authorization to them,
mark them authorized where authorized, then check if there are any
remaining unauthorized extensions or unsupported extensions requested.

Ultimately, if a CSR's KU/EKUs/SANs are all authorized, then they can
all be copied to a TBS, and a certificate can be issued.
2019-12-04 21:34:37 -06:00
Nicolas Williams
8af2d79d35 hx509: Add missing CSR extension request support
This is necessary in order to add proper support for CSRs in kx509,
where the KDC can examine all requested KUs/EKUs/SANs, check
authorization, and issue a certificate with all those extensions if
authorized.

This is the convention used by OpenSSL, of encoding all the KU, EKUs,
and SANs being requested as Extensions as they would appear in the
TBSCertificate, then putting those in as a single Attribute in the CSR's
Attributes list with attribute OID {id-pkcs-9, 14}.

 - expose all hx509_request_*() functions
 - finish support in hx509_request_parse*() for KU, EKU, and SAN CSR
   attributes
 - finish support in hx509_request_to_pkcs10() for encoding all
   requested KU, EKU, and SAN extensions as a CSR extReq (extension request)
 - add hx509_request_add_*() support for:
    - id-pkinit-san and ms-upn-pkinit-san
    - XMPP (Jabber) SAN
    - registeredID (useless but trivial)
 - add hxtool request-create options for all supported SANs
 - add hxtool request-create options for KeyUsage
 - add hxtool request-create options for ExtKeyUsage
 - add hxtool request-print support for all these things
 - fix bugs in existing id-pkinit-san handling

Possible future improvements

 - add HX509_TRACE env var and support (it would be nice to be able to
   observe why some certificate is rejected, or not matched in a query)
 - add testing that CSR creating and printing round-trip for all KUs,
   EKUs, and SANs
   (probably in tests/kdc/check-pkinit.in)
 - add testing that OpenSSL can print a CSR made by hxtool and
   vice-versa
 - hxtool ca: add KU sanity checking (via hx509_ca_sign() and/or friends)
   (don't allow encrypt for signing-only algs)
   (don't allow encrypt for RSA at all, or for RSA with small e exponents)
 - hxtool request-print: warn about all unknown attributes and
   extensions
 - hxtool ca: MAYBE add support for adding requested extensions from the
   --req=CSR
   ("Maybe" because CA operators should really verify and authorize all
    requested attributes, and should acknowledge that they have, and the
    simplest way to do this is to make them add all the corresponding
    CLI arguments to the hxtool ca command, but too, that is
    error-prone, thus it's not clear yet which approach is best.
    Perhaps interactively prompt for yes/no for each attribute.)
 - add additional SAN types:
    - iPAddress                 (useless?)
    - dNSSrv                    (useful!)
    - directoryName             (useless, but trivial)
    - uniformResourceIdentifier (useful)
 - it would be nice if the ASN.1 compiler could generate print
   functions..., and/or even better, to-JSON functions
 - it would be nice if we had a known-OID db, including the names of the
   types they refer to in certificate extensions, otherName SANs and CSR
   attributes, then we could generate a CSR and certificate printer for
   all known options even when they are not supported by the rest of
   Heimdal
    - and we could also get friendly names for OIDs, and we could
      resolve their arc names
    - longer term, we could also stand to add some ASN.1 information
      object system functionality, just enough to make
      lib/hx509/asn1_print awesome by being able to automatically decode
      all heim_any and OCTET STRING content (better than its current
      --inner option)
2019-10-08 22:20:40 -05:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
1b57c08324 Adapt to new request handling.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21341 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-26 14:20:56 +00:00
Love Hörnquist Åstrand
4f97424296 turn on stat collecting
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20782 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-02 00:46:00 +00:00
Love Hörnquist Åstrand
b9da6ebef0 sprinle stat saveing
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20780 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-01 22:17:03 +00:00
Love Hörnquist Åstrand
8a02fd12ed no random, no RSA/DH tests
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19858 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-01-11 20:48:34 +00:00
Love Hörnquist Åstrand
80977a02f6 Factor out private key operation out of the signing, operations, support import, export, and generation of private keys. Add support for writing PEM and PKCS12 files with private keys in them.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19778 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-01-09 10:52:13 +00:00
Love Hörnquist Åstrand
4f9be7d03f Parameterise the invocation of hxtool, so we can make it run under TESTS_ENVIRONMENT. From Andrew Bartlett
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18388 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-10 09:24:07 +00:00
Love Hörnquist Åstrand
1d8bb73fcf DH and RSA method names are renamed
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17503 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-05-07 11:59:30 +00:00
Love Hörnquist Åstrand
90828a636b SKIP test if there is no RSA support.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17187 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-04-23 21:04:56 +00:00
Love Hörnquist Åstrand
137496caa9 adapt to rename of pkcs10-create to request-create
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16982 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-04-03 07:56:34 +00:00
Love Hörnquist Åstrand
ccdec7c9ae Test for pkcs10 commands.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16976 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-04-03 05:31:42 +00:00