@@ -115,6 +115,13 @@ type basicResponse struct {
115
115
Certificates []asn1.RawValue `asn1:"explicit,tag:0,optional"`
116
116
}
117
117
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
+
118
125
type responseData struct {
119
126
Raw asn1.RawContent
120
127
Version int `asn1:"optional,default:0,explicit,tag:0"`
@@ -428,24 +435,12 @@ func (resp *Response) CheckSignatureFrom(issuer *x509.Certificate) error {
428
435
// Marshal marshals the OCSP response to ASN.1 DER encoded form
429
436
func (resp * Response ) Marshal () ([]byte , error ) {
430
437
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
-
443
438
signatureAlgorithm , err := signingParamsForAlgo (resp .SignatureAlgorithm )
444
439
if err != nil {
445
440
return nil , err
446
441
}
447
- response := basicResponse {
448
- TBSResponseData : tbsResponseData ,
442
+ response := basicResponseRawTBS {
443
+ TBSResponseData : asn1. RawValue { FullBytes : resp . TBSResponseData } ,
449
444
SignatureAlgorithm : signatureAlgorithm ,
450
445
Signature : asn1.BitString {
451
446
Bytes : resp .Signature ,
0 commit comments