{"size": 2987, "ext": "scrbl", "max_stars_repo_path": "doc/utils/rfc/x.509.scrbl", "max_stars_repo_name": "david135/sagittarius-scheme", "max_stars_repo_stars_event_min_datetime": "2015-11-07T07:13:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T03:35:14.000Z", "max_issues_repo_path": "doc/utils/rfc/x.509.scrbl", "max_issues_repo_name": "david135/sagittarius-scheme", "max_issues_repo_issues_event_min_datetime": "2016-04-28T21:59:59.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-01T08:42:21.000Z", "max_forks_repo_path": "doc/utils/rfc/x.509.scrbl", "max_forks_repo_name": "david135/sagittarius-scheme", "max_forks_repo_forks_event_min_datetime": "2016-12-28T12:41:23.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-26T20:52:02.000Z"}
{"max_stars_count": 39, "max_issues_count": 3, "max_forks_count": 4, "avg_line_length": 39.8266666667, "max_line_length": 79, "alphanum_fraction": 0.749916304}
@; -*- coding: utf-8 -*-
@subsection[:tag "rfc.x.509"]{(rfc x.509) - X.509 certificate utility library}

This library does not support whole feature of X.509, it just parse and verify
a message and signature. So it can not verify certificate itself.

@define[Library]{@name{(rfc x.509)}}
@desc{Exports X.509 utility procedures.}

@define[Generic]{@name{make-x509-certificate} @args{(in <port>)}}
@define[Generic]{@name{make-x509-certificate}
 @args{(sequence <asn.1-sequence>)}}
@desc{Creates an X.509 certificate object from given binary input port or ASN.1
sequence object (second form).
}

@define[Function]{@name{x509-certificate?} @args{o}}
@desc{Return #t if the @var{o} is X.509 certificate object, otherwise #f.}

@define[Function]{@name{x509-certificate-get-version} @args{x509}}
@desc{Return version of given X.509 certificate object.}

@define[Function]{@name{x509-certificate-get-serial-number} @args{x509}}
@desc{Return serial number of given X.509 certificate object.}

@define[Function]{@name{x509-certificate-get-issuer-dn} @args{x509}}
@desc{Return issuer DN of given X.509 certificate object as X.509 principal.}

@define[Function]{@name{x509-certificate-get-subject-dn} @args{x509}}
@desc{Return subject DN of given X.509 certificate object as X.509 principal.

NOTE: These Issuer DN and Subject DN getters return <x.509-principal> object,
however I did not implement any utility for this class, so it's just useless
for now.
}

@define[Function]{@name{x509-certificate-get-not-before} @args{x509}}
@desc{Return start date of given X.509 certificate object.}

@define[Function]{@name{x509-certificate-get-not-after} @args{x509}}
@desc{Return end date of given X.509 certificate object.}

@define[Function]{@name{x509-certificate-get-signature} @args{x509}}
@desc{Return signature of given X.509 certificate object. 

NOTE: This signature is not for @code{verify} described below.
}

@define[Function]{@name{x509-certificate-get-signature-algorithm} @args{x509}}
@desc{Return signature algorithm of given X.509 certificate object as an OID
string.}

@define[Function]{@name{x509-certificate-get-public-key} @args{x509}}
@desc{Return public key of given X.509 certificate object. The return value is
@code{<public-key>} described in the section
@secref["crypto"]{(crypto) - Cryptographic library}.
}

@define[Function]{@name{verify} @args{x509 message signature
  :key (verify pkcs1-emsa-v1.5-verify) (hash SHA-1)}}
@desc{@var{message} and @var{signature} must be bytevector.

Verify given @var{message} with @var{signature} and @var{x509} certificate.

This procedure uses the @code{verify} procedure in @code{(crypto)} library. The
keyword arguments will be passed to it. For more detail, see
@secref["crypto"]{(crypto) - Cryptographic library}.
}

@define[Function]{@name{check-validity}
 @args{x509 :optional (date (current-date))}}
@desc{Validate if the given certificate is valid in given @var{date}. Return #t
if it's valid, otherwise raises @code{&assertion}.
}
