Просмотр исходного кода

Prevent panics when instantiating SCEP authority without intermediates

Herman Slatman 11 месяцев назад
Родитель
Сommit
99e8f6c2c6
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      authority/authority.go

+ 5 - 1
authority/authority.go

@@ -757,7 +757,11 @@ func (a *Authority) init() error {
 						// only pass the decrypter down when it was successfully created,
 						// meaning it's an RSA key, and `CreateDecrypter` did not fail.
 						options.Decrypter = decrypter
-						options.DecrypterCert = options.Intermediates[0]
+
+						// intermediate certificates can be empty in RA mode
+						if len(options.Intermediates) > 0 {
+							options.DecrypterCert = options.Intermediates[0]
+						}
 					}
 				}
 			}