summaryrefslogtreecommitdiff
path: root/usr.sbin/rpki-client/x509.c
AgeCommit message (Collapse)Author
2023-03-12Refactor expiration calculationJob Snijders
Unify common code paths which find the exact expiry moment into a new helper function. Additionally, the new helper offers more accuracy by checking more applicable CRLs whether their 'nextupdate' is 'sooner'. tb@ noted: The helper adds a multiplier of log(#crls), but that's certainly acceptable as it is still very cheap. OK tb@
2023-03-10mechanical change, rename struct members to match the original X509 namesJob Snijders
OK tb@
2023-03-10Show the X.509 notBefore in filemodeJob Snijders
OK tb@
2023-03-06Enforce X509v3 SKIs to be the SHA-1 hash of the Subject Public KeyJob Snijders
In the RPKI-context (RFC 6487 section 4.8.2), SKIs are not at all arbitary identifiers: they must be the SHA-1 hash of the 'Subject Public Key'. Add a SPK digest calculation and comparison to the X509v3 extension containing the SKI. OK tb@
2023-02-16Revert r1.63.Theo Buehler
GEN_OTHERNAME is the type of a GENERAL_NAMES, not of a DIST_POINT_NAME, which needs naked numbers as there is no enum nor defines describing it. claudio agrees
2023-02-16Add missing RFC 6487 section 4.8.6 CRLDP compliance checksJob Snijders
OK tb@ claudio@
2023-02-09Use GEN_OTHERNAME instead of hardcoding 0Theo Buehler
discussed with job
2022-11-30Remove unused sys/socket.h includeJob Snijders
OK claudio@
2022-11-29Only include stdarg.h, if we call any of va_{start,end}()Job Snijders
OK tb@
2022-11-29Only include assert.h if we call assert()Job Snijders
OK tb@
2022-11-26Add support for authenticating geofeed data CSV files in filemodeJob Snijders
RFC 9092 describes a scheme in which an authenticator is appended to a geofeed (RFC 8805) file. It is a digest of the main body of the file signed by the private key of the relevant RPKI certificate for a covering address range. The authenticator is a detached CMS signature. with and OK tb@
2022-11-07Confirm Path Length is absent in the Basic Constraints extensionJob Snijders
OK tb@
2022-11-06Next to signedObject only allow rpkiNotify accessMethodsTheo Buehler
Instead of ignoring all non-signedObject accessMethods, we can be stricter and only allow rpkiNotify (for now) and error on anything else. Also make sure we properly clean up behind ourselves on error. With and ok job
2022-11-04Do not fail on non-rsync URIs in EE cert SIA extensionsTheo Buehler
The spec allows multiple accessMethod entries, ordered by preference. While an rsync URI must be present, others are allowed. Do not fail in that situation and pick the first rsync URI encountered. The logic is very similar to the one in x509_get_crl(). ok job
2022-11-04In very verbose mode, log unexpected accessMethodsTheo Buehler
While RFC 6487, 4.8.2.2 is very explicit about allowing id-ad-signedObject as the only accessMethod, the clear language was lost during the RFC 8182 editing process. APNIC, TWNIC and JPNIC and a few others are currently known to have an id-ad-rpkiNotify. The verbose logging allows us to check the ecosystem while waiting for the point in time where we can turn this into an error. See also https://www.rfc-editor.org/errata/eid7239. ok job
2022-11-04Check the SIA signedObject in ROA/MFT/ASPA/TAK/GBR EE certificatesJob Snijders
Unfortunately we can't yet error out when accessMethods other than signedObject are encountered in the SubjectInformationAccess extension because there is pollution in the ecosystem. OK tb@
2022-11-02Add support for draft-ietf-sidrops-signed-tal-12Job Snijders
Add support validation of Signed Objects containing Trust Anchor Keys (TAKs - aka 'Signed TALs'). Signed TALs provide a mechanism for RIRs to distribute and sign the next Trust Anchor with the current Trust Anchor. This might be an improvement over visiting RIR websites and copy+pasting TAL data by hand. OK tb@
2022-11-02Fix x509_get_time() error checksTheo Buehler
Like most x509_* functions, x509_get_time() returns 0/1 on error/success, not -1/0. ok claudio job
2022-10-24Make x509_init_oid() table basedTheo Buehler
Reduces the amount of copy-paste and makes things easier on the eye. ok claudio job
2022-09-03Introduce x509_any_inherit() for objects which may not have inherit elementsJob Snijders
Unify conformance checking of Trust Anchors, ROAs, ASPAs, RSCs - none of which may have any 'inherit' elements in the RFC 3779 IP/AS Resources extension of the X509 certificate. OK tb@
2022-09-03Allow multiple X.509 locationsTheo Buehler
While currently everyone only uses a single location, the spec allows for multiple locations ordered by preference. While rpki-client does not support more than one location this should not be a fatal error. Instead, pick the first location and warn if there are more than one. ok job
2022-08-30Add support for ASPA objects (draft-ietf-sidrops-aspa-profile-10)Job Snijders
ASPA objects are published in the RPKI and can be used to detect and mitigate BGP route leaks. Validated ASPA Payloads are visible through filemode (-f) and the JSON output format (-j). With feedback from tb@ OK claudio@ tb@
2022-07-28Fix RFC number in commentTheo Buehler
2022-05-31I made non-trivial contributions to these files.Theo Buehler
2022-05-15More KNF and whitespace fixes.Theo Buehler
2022-05-11Verify MFT and GBR objects only carry RFC 3779 extensions set to 'inherit'Job Snijders
OK claudio@ tb@
2022-05-10Confirm the absense of the Basic Constraints extension in non-CA certsJob Snijders
with and OK tb@
2022-05-09Commit file missed in previous.Theo Buehler
2022-04-15Allow more than one CRL URI in certificatesTheo Buehler
The spec (RFC 6487, 4.8.6) expresses a preference for a single rsync URI but allows for other URIs in the CRL distributionPoint. This doesn't currently happen in practice but could come at some point. So look for the rsync URI and skip over others, which is more correct and might help in the future. Pointed out by & ok claudio
2022-04-12Generalize sbgp_sia_location() to x509_location()Theo Buehler
AIA and CRL URIs can reuse the code in sbgp_sia_location and thus get the same checks as the SIA locations. This eliminates some more duplication and makes the checks more stringent in that embedded NULs and "./" are no longer allowed. ok claudio
2022-04-08All times in the x509 are UTC so use timegm() and not mktime().Claudio Jeker
The latter will apply the timezone offset and so the further west the more probable you are to have problems with valid_from times. Fix from tb@ OK job@, benno@ and me
2022-04-01Change x509_get_aki(), x509_get_ski(), x509_get_aia(), and x509_get_crl()Claudio Jeker
to work more like x509_get_expire(). They will return an error if the extension extraction failed but not if it was not present. The callers must now do that check but most did already. With this cert_parse_inner() no longer cares about TA vs non-TA certs. Feedback and OK tb@
2022-03-25Implement most of the CMS related checks required by RFC 6488 section 3Claudio Jeker
Verify that SignerInfo and Signed Attributes are set according to the RFC. Especially enforce that the right attributes are signed. Check that there are no unsigned attributes, no CRL and that the correct content-type, digest and signature algorithm are used. The OpenSSL API makes it impossible to verify the versions and some other more suttle differences like detecting signle attributes vs a SET OF one. Similarly OpenSSL accepts both DER and BER encoding in the payload. These smaller differences to the RFC are not optimal but not a risk. Lots of feedback and OK tb@
2022-02-10Fix serial number printing in crl_print() for large serials.Claudio Jeker
Create a common x509_convert_seqnum() function to convert the various ASN1_INTEGERs into hexnumbers and use this for mft and crl handling. With and OK tb@, also OK job@
2022-02-10Implement some code to print crls with -f.Claudio Jeker
For this introduce x509_get_time() that converts a ASN1_TIME to time_t. Also move time2str() to print.c where it makes more sense. This needs more work but that will happen in tree. OK tb@
2022-02-04Add id-cp-ipAddr-asNumber OID to x509_init_oid()Theo Buehler
Unfortunately, NID_ipAddr_asNumber is not available in LibreSSL < 3.3 and OpenSSL, so load its OID by hand to help -portable. This will be used for certificate policy checks. ok claudio
2022-02-02typoTheo Buehler
2022-01-18Kill extra newlineClaudio Jeker
2022-01-18Fix function name in warn message.Theo Buehler
2022-01-18Cleanup the scattered OBJ_txt2obj() calls and move them intoClaudio Jeker
x509_init_oid() to initalize all necessary OID objects at start. OK tb@
2021-10-28Don't exit in certain cases on failures to parse x509 objects.Bob Beck
In most cases we already warn and continue if someone sends us malformed x509 objects. This makes this consistent behaviour in all places so that if someone passes in bogus X509, We end up failing their entry and continuing rather than exiting. We still exit on memory/system failures so that a future run of rpki client can simply do better when the machine is perhaps less hammered on ok job@ claudio@
2021-10-27Add limits on size of certain untrusted inputsBob Beck
ok job@
2021-10-24Add my copyright to some filesClaudio Jeker
OK job@
2021-10-24Improve variable namingJob Snijders
OK tb@ claudio@
2021-10-12Emit SKI in the JSON output and improve flow in x509_get_pubkey()Job Snijders
OK claudio@
2021-10-11Add support for BGPsec Router Certificates (RFC 8209)Job Snijders
BGPsec router keys are extracted from RPKI certificates and emitted via the JSON output in base64 encoded form. OK tb@ claudio@
2021-10-07Add x509_get_expire() to extract the not-after time from a certificateClaudio Jeker
as a epoch time_t. Store the expire time for certs, crls will follow after. OK tb@
2021-10-05Add rudimentary support for BGPsec router certificatesJob Snijders
OK claudio@
2021-04-01Move base64 and hex encoding functions into their own place.Claudio Jeker
OK tb@
2021-03-29Introduce hex_encode() to transform the aki/ski values to a string.Claudio Jeker
OK tb@