@@ -181,7 +181,9 @@ func (b *Builder) BuildSelfSignedX509CATemplate(ctx context.Context, params Self
181
181
if err != nil {
182
182
return nil , err
183
183
}
184
- applyX509CAAttributes (tmpl , attributes )
184
+ if err := applyX509CAAttributes (tmpl , attributes ); err != nil {
185
+ return nil , err
186
+ }
185
187
}
186
188
187
189
return tmpl , nil
@@ -198,11 +200,13 @@ func (b *Builder) BuildUpstreamSignedX509CACSR(ctx context.Context, params Upstr
198
200
if err != nil {
199
201
return nil , err
200
202
}
201
- applyX509CAAttributes (tmpl , attributes )
203
+ if err := applyX509CAAttributes (tmpl , attributes ); err != nil {
204
+ return nil , err
205
+ }
202
206
}
203
207
204
208
// Create the CertificateRequest from the Certificate template. The
205
- // PolicyIdentifiers field is ignored since that can be applied by the
209
+ // Policies field is ignored since that can be applied by the
206
210
// upstream signer and isn't a part of the native CertificateRequest type.
207
211
// TODO: maybe revisit this if needed and embed the policy identifiers in
208
212
// the extra extensions.
@@ -237,7 +241,9 @@ func (b *Builder) BuildDownstreamX509CATemplate(ctx context.Context, params Down
237
241
if err != nil {
238
242
return nil , err
239
243
}
240
- applyX509CAAttributes (tmpl , attributes )
244
+ if err := applyX509CAAttributes (tmpl , attributes ); err != nil {
245
+ return nil , err
246
+ }
241
247
}
242
248
243
249
return tmpl , nil
@@ -458,9 +464,9 @@ func (b *Builder) computeX509SVIDLifetime(parentChain []*x509.Certificate, ttl t
458
464
459
465
func x509CAAttributesFromTemplate (tmpl * x509.Certificate ) credentialcomposer.X509CAAttributes {
460
466
return credentialcomposer.X509CAAttributes {
461
- Subject : tmpl .Subject ,
462
- PolicyIdentifiers : tmpl .PolicyIdentifiers ,
463
- ExtraExtensions : tmpl .ExtraExtensions ,
467
+ Subject : tmpl .Subject ,
468
+ Policies : tmpl .Policies ,
469
+ ExtraExtensions : tmpl .ExtraExtensions ,
464
470
}
465
471
}
466
472
func x509SVIDAttributesFromTemplate (tmpl * x509.Certificate ) credentialcomposer.X509SVIDAttributes {
@@ -471,10 +477,11 @@ func x509SVIDAttributesFromTemplate(tmpl *x509.Certificate) credentialcomposer.X
471
477
}
472
478
}
473
479
474
- func applyX509CAAttributes (tmpl * x509.Certificate , attribs credentialcomposer.X509CAAttributes ) {
480
+ func applyX509CAAttributes (tmpl * x509.Certificate , attribs credentialcomposer.X509CAAttributes ) error {
475
481
tmpl .Subject = attribs .Subject
476
- tmpl .PolicyIdentifiers = attribs .PolicyIdentifiers
482
+ tmpl .Policies = attribs .Policies
477
483
tmpl .ExtraExtensions = attribs .ExtraExtensions
484
+ return nil
478
485
}
479
486
480
487
func applyX509SVIDAttributes (tmpl * x509.Certificate , attribs credentialcomposer.X509SVIDAttributes ) {
0 commit comments