tls: declare the peer's certificate in std/tls (commit 2 of 2 for #116) #463
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Commit 2 of 2 for FIRST-PARTY.md gap 18.
CLAUDE.md"Seed and breaking changes": a new native thatstd/declares has to be known to the seed first. #116 adds the runtime function and the natives row and declares nothing instd/; this issue declares it, after a seed that contains the merge of #116 is published (as #363 did after #362).Depends on
#116 merged, and a published seed at or after its merge commit (
seeds.txtof theseedsrelease lists one). Notreadybefore.Design
std/tls/src/lib.trb:native fn tlsPeerCertificate(session: Int, var into: Buffer<UInt8>): Int(appends the DER of the leaf certificate the peer sent, answers how many bytes; 0 where there is none or the handshake is not done).TlsStream.peerCertificate(): Bytes?besideprotocol():Some(der)of the peer's own certificate (leaf first, DER, not PEM),Noneon a server-side stream (no client certificate is requested until #117) and before the handshake is done (cannot happen throughconnect/accept, which finish it). Doc comment names channel binding (tls-server-end-point, RFC 5929) and pinning as the uses, and says the bytes are the certificate as sent, whether or not it was verified againsttrusted.tls-server-end-pointstays with the driver (torb/postgres): it needs the certificate's signature algorithm, which is not this issue.Acceptance criteria
tlsPeerCertificatedeclared instd/tls;TlsStream.peerCertificate()documented with an example.std/tls(ortests/conformance/tls-loopback.trbextended): a loopback handshake with the test certificate; the client'speerCertificate()equals the DER of the server's certificate (decode the PEM of the test chain, first block), the server's isNone.docs/standard-library/tls.mddocuments the method;skills/regenerated (torb docs skill docs skills).Seed impact
No: the native is known to the seed since #116's merge.
Size
One PR, one Conventional Commit:
feat(tls): the peer's certificate from a TlsStream.TlsStream#116TlsStream#116[loop:torbscript] refine: body written (design, acceptance criteria, seed impact, size are in it); step 2 of #116. next: waiting (depends on #116 merged and a published seed that contains it)
Buffer.holdsClose(step 2 of #55, commit 1 of 2) #468Buffer.holdsClose(step 2 of #55, commit 1 of 2) #468