@@ -233,7 +233,11 @@ func parseCert(in []byte, privAlgo string) (*Certificate, error) {
233
233
if err != nil {
234
234
return nil , err
235
235
}
236
-
236
+ // The Type() function is intended to return only certificate key types, but
237
+ // we use certKeyAlgoNames anyway for safety, to match [Certificate.Type].
238
+ if _ , ok := certKeyAlgoNames [k .Type ()]; ok {
239
+ return nil , fmt .Errorf ("ssh: the signature key type %q is invalid for certificates" , k .Type ())
240
+ }
237
241
c .SignatureKey = k
238
242
c .Signature , rest , ok = parseSignatureBody (g .Signature )
239
243
if ! ok || len (rest ) > 0 {
@@ -301,16 +305,13 @@ type CertChecker struct {
301
305
SupportedCriticalOptions []string
302
306
303
307
// IsUserAuthority should return true if the key is recognized as an
304
- // authority for the given user certificate. This allows for
305
- // certificates to be signed by other certificates. This must be set
306
- // if this CertChecker will be checking user certificates.
308
+ // authority for user certificate. This must be set if this CertChecker
309
+ // will be checking user certificates.
307
310
IsUserAuthority func (auth PublicKey ) bool
308
311
309
312
// IsHostAuthority should report whether the key is recognized as
310
- // an authority for this host. This allows for certificates to be
311
- // signed by other keys, and for those other keys to only be valid
312
- // signers for particular hostnames. This must be set if this
313
- // CertChecker will be checking host certificates.
313
+ // an authority for this host. This must be set if this CertChecker
314
+ // will be checking host certificates.
314
315
IsHostAuthority func (auth PublicKey , address string ) bool
315
316
316
317
// Clock is used for verifying time stamps. If nil, time.Now
0 commit comments