Exemplo
github.com/mholt/acmez/v3 v3.1.2: acme.ARIUniqueIdentifier
Amostra verificada para golang github.com/mholt/acmez/v3 v3.1.2: acme.ARIUniqueIdentifier. O contrato rodou em go 1.26 · linux alpine/x64 · docker e passou.
sha256:016803df293cdd73739190a8ad6bc70311b4b03259e8172a26bed371b3fc9d04
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 go
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-28 |
Caso
HOW- Objetivo
- verify github.com/mholt/acmez/v3/acme.ARIUniqueIdentifier in pkg:golang/github.com/mholt/acmez/v3@v3.1.2
- Pacotes
- Símbolos
-
- github.com/mholt/acmez/v3/acme.ARIUniqueIdentifier
- Criado
- 2026-08-28T01:11:42Z
Contrato
- acme.ARIUniqueIdentifier returns error when leaf certificate has nil SerialNumber
- acme.ARIUniqueIdentifier constructs unique identifier combining Base64URL-encoded AuthorityKeyId and serial number DER bytes separated by dot
- acme.ARIUniqueIdentifier properly handles serial numbers with leading high bit via ASN.1 DER integer encoding
- acme.ARIUniqueIdentifier computes valid renewal identifier from parsed x509.Certificate with AuthorityKeyId and serial number
Arquivos
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Código-fonte
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify github.com/mholt/acmez/v3/acme.ARIUniqueIdentifier in pkg:golang/github.com/mholt/acmez/v3@v3.1.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/mholt/acmez/v3@v3.1.2
Demonstrate these symbols/APIs:
- github.com/mholt/acmez/v3/acme.ARIUniqueIdentifier
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:33762a1990a4f5a117547de434ca78754652ed4a117c606e503261a8267fe411","contract":["acme.ARIUniqueIdentifier returns error when leaf certificate has nil SerialNumber","acme.ARIUniqueIdentifier constructs unique identifier combining Base64URL-encoded AuthorityKeyId and serial number DER bytes separated by dot","acme.ARIUniqueIdentifier properly handles serial numbers with leading high bit via ASN.1 DER integer encoding","acme.ARIUniqueIdentifier computes valid renewal identifier from parsed x509.Certificate with AuthorityKeyId and serial number"],"goal":"verify github.com/mholt/acmez/v3/acme.ARIUniqueIdentifier in pkg:golang/github.com/mholt/acmez/v3@v3.1.2","kind":"HOW","packages":["pkg:golang/github.com/mholt/acmez/v3@v3.1.2"],"schemaVersion":1,"symbols":["github.com/mholt/acmez/v3/acme.ARIUniqueIdentifier"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/mholt/acmez/v3@v3.1.2"],"schemaVersion":1,"subject":"pkg:golang/github.com/mholt/acmez/v3@v3.1.2","symbols":["github.com/mholt/acmez/v3/acme.ARIUniqueIdentifier"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.22.0
require github.com/mholt/acmez/v3 v3.1.2
github.com/mholt/acmez/v3 v3.1.2 h1:auob8J/0FhmdClQicvJvuDavgd5ezwLBfKuYmynhYzc=
github.com/mholt/acmez/v3 v3.1.2/go.mod h1:L1wOU06KKvq7tswuMDwKdcHeKpFFgkppZy/y0DFxagQ=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
package main
import (
"crypto/x509"
"fmt"
"math/big"
"os"
"github.com/mholt/acmez/v3/acme"
)
// GenerateCertARIIdentifier returns the ARI unique identifier string for a certificate.
func GenerateCertARIIdentifier(cert *x509.Certificate) (string, error) {
return acme.ARIUniqueIdentifier(cert)
}
func main() {
cert := &x509.Certificate{
AuthorityKeyId: []byte{0x01, 0x02, 0x03, 0x04, 0x05},
SerialNumber: big.NewInt(987654321),
}
id, err := GenerateCertARIIdentifier(cert)
if err != nil {
fmt.Fprintf(os.Stderr, "Error generating ARI ID: %v\n", err)
os.Exit(1)
}
fmt.Printf("ARI Unique Identifier: %s\n", id)
}
{
"schemaVersion": 1,
"goal": "verify github.com/mholt/acmez/v3/acme.ARIUniqueIdentifier in pkg:golang/github.com/mholt/acmez/v3@v3.1.2",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/mholt/acmez/v3@v3.1.2"
],
"symbols": [
"github.com/mholt/acmez/v3/acme.ARIUniqueIdentifier"
]
}
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/asn1"
"encoding/base64"
"fmt"
"math/big"
"os"
"strings"
"time"
"github.com/mholt/acmez/v3/acme"
)
func main() {
// Assertion 1: acme.ARIUniqueIdentifier returns error when leaf certificate has nil SerialNumber
nilSerialCert := &x509.Certificate{
AuthorityKeyId: []byte{0x01, 0x02, 0x03, 0x04},
SerialNumber: nil,
}
if _, err := acme.ARIUniqueIdentifier(nilSerialCert); err == nil {
fmt.Fprintf(os.Stderr, "FAIL: acme.ARIUniqueIdentifier expected error for nil SerialNumber\n")
os.Exit(1)
}
// Assertion 2: acme.ARIUniqueIdentifier constructs unique identifier combining Base64URL-encoded AuthorityKeyId and serial number DER bytes separated by dot
aki := []byte{0x10, 0x20, 0x30, 0x40, 0x50}
serial := big.NewInt(123456789)
cert := &x509.Certificate{
AuthorityKeyId: aki,
SerialNumber: serial,
}
id, err := acme.ARIUniqueIdentifier(cert)
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: acme.ARIUniqueIdentifier returned unexpected error: %v\n", err)
os.Exit(1)
}
parts := strings.Split(id, ".")
if len(parts) != 2 {
fmt.Fprintf(os.Stderr, "FAIL: expected ARI identifier to contain exactly two dot-separated parts, got: %s\n", id)
os.Exit(1)
}
expectedAKI := base64.RawURLEncoding.EncodeToString(aki)
if parts[0] != expectedAKI {
fmt.Fprintf(os.Stderr, "FAIL: AKI part mismatch: got %s, want %s\n", parts[0], expectedAKI)
os.Exit(1)
}
serialDER, err := asn1.Marshal(serial)
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: asn1.Marshal failed: %v\n", err)
os.Exit(1)
}
expectedSerial := base64.RawURLEncoding.EncodeToString(serialDER[2:])
if parts[1] != expectedSerial {
fmt.Fprintf(os.Stderr, "FAIL: serial part mismatch: got %s, want %s\n", parts[1], expectedSerial)
os.Exit(1)
}
// Assertion 3: acme.ARIUniqueIdentifier properly handles serial numbers with leading high bit via ASN.1 DER integer encoding
serialHighBit, ok := new(big.Int).SetString("80000000000000000000000000000001", 16)
if !ok {
fmt.Fprintf(os.Stderr, "FAIL: failed to parse high bit serial\n")
os.Exit(1)
}
certHighBit := &x509.Certificate{
AuthorityKeyId: []byte{0xAA, 0xBB, 0xCC},
SerialNumber: serialHighBit,
}
idHighBit, err := acme.ARIUniqueIdentifier(certHighBit)
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: acme.ARIUniqueIdentifier failed for high-bit serial: %v\n", err)
os.Exit(1)
}
partsHighBit := strings.Split(idHighBit, ".")
if len(partsHighBit) != 2 {
fmt.Fprintf(os.Stderr, "FAIL: high-bit ARI identifier malformed: %s\n", idHighBit)
os.Exit(1)
}
highBitDER, err := asn1.Marshal(serialHighBit)
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: asn1.Marshal high bit failed: %v\n", err)
os.Exit(1)
}
expectedHighBitSerial := base64.RawURLEncoding.EncodeToString(highBitDER[2:])
if partsHighBit[1] != expectedHighBitSerial {
fmt.Fprintf(os.Stderr, "FAIL: high bit serial mismatch: got %s, want %s\n", partsHighBit[1], expectedHighBitSerial)
os.Exit(1)
}
// Assertion 4: acme.ARIUniqueIdentifier computes valid renewal identifier from parsed x509.Certificate with AuthorityKeyId and serial number
privKey, err := rsa.GenerateKey(rand.Reader, 2048)
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: failed to generate rsa key: %v\n", err)
os.Exit(1)
}
now := time.Now()
template := &x509.Certificate{
SerialNumber: big.NewInt(9876543210),
Subject: pkix.Name{
CommonName: "example.com",
},
AuthorityKeyId: []byte{0xDE, 0xAD, 0xBE, 0xEF, 0x01, 0x02},
NotBefore: now.Add(-1 * time.Hour),
NotAfter: now.Add(24 * time.Hour),
}
certDER, err := x509.CreateCertificate(rand.Reader, template, template, &privKey.PublicKey, privKey)
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: failed to create certificate: %v\n", err)
os.Exit(1)
}
parsedCert, err := x509.ParseCertificate(certDER)
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: failed to parse certificate: %v\n", err)
os.Exit(1)
}
parsedID, err := acme.ARIUniqueIdentifier(parsedCert)
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: acme.ARIUniqueIdentifier failed for parsed cert: %v\n", err)
os.Exit(1)
}
expectedParsedAKI := base64.RawURLEncoding.EncodeToString(template.AuthorityKeyId)
parsedDER, _ := asn1.Marshal(template.SerialNumber)
expectedParsedSerial := base64.RawURLEncoding.EncodeToString(parsedDER[2:])
expectedParsedID := expectedParsedAKI + "." + expectedParsedSerial
if parsedID != expectedParsedID {
fmt.Fprintf(os.Stderr, "FAIL: parsed cert ARI ID mismatch: got %s, want %s\n", parsedID, expectedParsedID)
os.Exit(1)
}
fmt.Println("PASS: all ARIUniqueIdentifier contract assertions passed.")
}
Seeder de origem
anônimo