Jelajahi Sumber

Prevent panics when instantiating SCEP authority without intermediates

Herman Slatman 11 bulan lalu
induk
melakukan
99e8f6c2c6
1 mengubah file dengan 5 tambahan dan 1 penghapusan
  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]
+						}
 					}
 				}
 			}