File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -263,7 +263,13 @@ public async Task<CertificateModel> IssueCertificateAsync(
263263 pfxBytes = cert . ToPfx ( privateKey ) . Build ( domains [ 0 ] , null ) ;
264264 log ? . Invoke ( "[CERT] PFX file built successfully" ) ;
265265 }
266- catch ( Exception ex )
266+ catch ( CryptographicException ex )
267+ {
268+ log ? . Invoke ( $ "[CERT] ⚠️ PFX build failed ({ ex . GetType ( ) . Name } : { ex . Message } ). Falling back to leaf-only PFX export.") ;
269+ pfxBytes = BuildLeafOnlyPfx ( leafCertificatePem , privateKeyPem ) ;
270+ log ? . Invoke ( "[CERT] Fallback PFX created (leaf certificate only)" ) ;
271+ }
272+ catch ( InvalidOperationException ex )
267273 {
268274 log ? . Invoke ( $ "[CERT] ⚠️ PFX build failed ({ ex . GetType ( ) . Name } : { ex . Message } ). Falling back to leaf-only PFX export.") ;
269275 pfxBytes = BuildLeafOnlyPfx ( leafCertificatePem , privateKeyPem ) ;
You can’t perform that action at this time.
0 commit comments