Skip to content

Commit 18876f6

Browse files
fixup
1 parent f888226 commit 18876f6

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

ocsp/ocsp.go

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ type basicResponse struct {
115115
Certificates []asn1.RawValue `asn1:"explicit,tag:0,optional"`
116116
}
117117

118+
type basicResponseRawTBS struct {
119+
TBSResponseData asn1.RawValue
120+
SignatureAlgorithm pkix.AlgorithmIdentifier
121+
Signature asn1.BitString
122+
Certificates []asn1.RawValue `asn1:"explicit,tag:0,optional"`
123+
}
124+
118125
type responseData struct {
119126
Raw asn1.RawContent
120127
Version int `asn1:"optional,default:0,explicit,tag:0"`
@@ -428,24 +435,12 @@ func (resp *Response) CheckSignatureFrom(issuer *x509.Certificate) error {
428435
// Marshal marshals the OCSP response to ASN.1 DER encoded form
429436
func (resp *Response) Marshal() ([]byte, error) {
430437

431-
var tbsResponseData responseData
432-
433-
rest, err := asn1.Unmarshal(resp.TBSResponseData, &tbsResponseData)
434-
435-
if len(rest) != 0 {
436-
return nil, errors.New("trailing data in resp.TBSResponseData")
437-
}
438-
439-
if err != nil {
440-
return nil, err
441-
}
442-
443438
signatureAlgorithm, err := signingParamsForAlgo(resp.SignatureAlgorithm)
444439
if err != nil {
445440
return nil, err
446441
}
447-
response := basicResponse{
448-
TBSResponseData: tbsResponseData,
442+
response := basicResponseRawTBS{
443+
TBSResponseData: asn1.RawValue{FullBytes: resp.TBSResponseData},
449444
SignatureAlgorithm: signatureAlgorithm,
450445
Signature: asn1.BitString{
451446
Bytes: resp.Signature,

0 commit comments

Comments
 (0)