Documentation
¶
Overview ¶
Package rfc3161 implements the bounded Forecast Ledger RFC 3161 profile. Dependency-specific types do not cross this package boundary.
Index ¶
- Constants
- func MetadataMatches(metadata Metadata, genTime, policyOID, serialNumber, hashAlgorithm string) error
- func NormalizeEndpoint(raw string) (string, error)
- func ParseResponse(data []byte, limits Limits) error
- func ValidateCABundle(data []byte, limits Limits) error
- type Error
- type HTTPClient
- type Limits
- type Metadata
- type Reason
- type RequestInfo
- type Resolver
- type SubmitResult
Constants ¶
const ( HashAlgorithm = "sha256" MaxTargetBytes = 1 << 20 MaxRequestBytes = 64 << 10 MaxResponseBytes = 1 << 20 MaxCABundleBytes = 1 << 20 MaxCertificates = 64 MaxSignerInfos = 8 MaxExtensions = 32 )
const DefaultHTTPTimeout = 15 * time.Second
Variables ¶
This section is empty.
Functions ¶
func MetadataMatches ¶
func MetadataMatches(metadata Metadata, genTime, policyOID, serialNumber, hashAlgorithm string) error
MetadataMatches compares parsed verified metadata with one ledger entry.
func NormalizeEndpoint ¶
NormalizeEndpoint performs the no-network part of TSA endpoint validation and returns a stable credential-free URL for path derivation and storage.
func ParseResponse ¶
ParseResponse performs bounded structural and successful-status parsing without claiming signature, trust-chain, request, or target verification.
func ValidateCABundle ¶
ValidateCABundle performs bounded PEM and certificate parsing without using system roots or making a network request.
Types ¶
type Error ¶
Error deliberately contains no request, response, certificate, target, or credential bytes. The underlying parser error is not exposed to callers.
type HTTPClient ¶
type HTTPClient struct {
Client *http.Client
Resolver Resolver
Limits Limits
Timeout time.Duration
}
HTTPClient is a constrained one-request TSA client. A custom Client is only an internal test seam; production uses a pinned-address transport built here.
func (HTTPClient) Submit ¶
func (c HTTPClient) Submit(ctx context.Context, endpoint string, request []byte) (SubmitResult, error)
type Limits ¶
type Limits struct {
TargetBytes int
RequestBytes int
ResponseBytes int
CABundleBytes int
Certificates int
SignerInfos int
Extensions int
}
Limits defines application-owned byte and collection limits.
func DefaultLimits ¶
func DefaultLimits() Limits
type Metadata ¶
type Metadata struct {
HashAlgorithm string `json:"hash_algorithm"`
GenTime time.Time `json:"gen_time"`
PolicyOID string `json:"policy_oid"`
SerialNumber string `json:"serial_number"`
SignerSubject string `json:"signer_subject"`
SignerFingerprint string `json:"signer_fingerprint_sha256"`
CABundleSHA256 string `json:"ca_bundle_sha256"`
}
Metadata is the safe verified projection retained in a Forecast Ledger.
type Reason ¶
type Reason string
Reason is a stable safe RFC 3161 failure category.
const ( ReasonLimit Reason = "rfc3161.limit" ReasonRequestMalformed Reason = "rfc3161.request_malformed" ReasonRequestProfile Reason = "rfc3161.request_profile" ReasonTargetMismatch Reason = "rfc3161.target_mismatch" ReasonResponseMalformed Reason = "rfc3161.response_malformed" ReasonResponseRejected Reason = "rfc3161.response_rejected" ReasonBindingMismatch Reason = "rfc3161.binding_mismatch" ReasonTokenMalformed Reason = "rfc3161.token_malformed" ReasonAlgorithm Reason = "rfc3161.algorithm_unsupported" ReasonTrustBundle Reason = "rfc3161.trust_bundle" ReasonSignature Reason = "rfc3161.signature" ReasonCertificate Reason = "rfc3161.certificate" ReasonMetadata Reason = "rfc3161.metadata" ReasonEntropy Reason = "rfc3161.entropy" )
func SafeReason ¶
SafeReason returns the stable reason without exposing parser details.
type RequestInfo ¶
type RequestInfo struct {
HashAlgorithm string `json:"hash_algorithm"`
HasNonce bool `json:"has_nonce"`
RequestsCert bool `json:"requests_certificate"`
}
RequestInfo is a safe parsed request projection.
func CreateRequest ¶
CreateRequest builds the exact supported request profile. Entropy must be a CSPRNG in production and is injectable only below adapters for tests.
func ParseRequest ¶
func ParseRequest(data, target []byte, limits Limits) (RequestInfo, error)
ParseRequest parses and enforces the supported request profile and target binding. It rejects trailing bytes that the dependency API otherwise ignores.