mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-15 19:10:47 +02:00
feat(security): add PFX alias for PKCS12; accept .crt/.cer/.der certs & .key keys; add certificate-signing tests (#4297)
This commit is contained in:
+1
@@ -186,6 +186,7 @@ public class CertSignController {
|
||||
"alias", privateKey, password.toCharArray(), new Certificate[] {cert});
|
||||
break;
|
||||
case "PKCS12":
|
||||
case "PFX":
|
||||
ks = KeyStore.getInstance("PKCS12");
|
||||
ks.load(p12File.getInputStream(), password.toCharArray());
|
||||
break;
|
||||
|
||||
+9
-4
@@ -15,20 +15,25 @@ public class SignPDFWithCertRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description = "The type of the digital certificate",
|
||||
allowableValues = {"PEM", "PKCS12", "JKS"},
|
||||
allowableValues = {"PEM", "PKCS12", "PFX", "JKS"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String certType;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"The private key for the digital certificate (required for PEM type"
|
||||
+ " certificates)")
|
||||
+ " certificates, supports .pem, .der, or .key files)")
|
||||
private MultipartFile privateKeyFile;
|
||||
|
||||
@Schema(description = "The digital certificate (required for PEM type certificates)")
|
||||
@Schema(
|
||||
description =
|
||||
"The digital certificate (required for PEM type certificates, supports"
|
||||
+ " .pem, .der, .crt, or .cer files)")
|
||||
private MultipartFile certFile;
|
||||
|
||||
@Schema(description = "The PKCS12 keystore file (required for PKCS12 type certificates)")
|
||||
@Schema(
|
||||
description =
|
||||
"The PKCS12/PFX keystore file (required for PKCS12 or PFX type certificates)")
|
||||
private MultipartFile p12File;
|
||||
|
||||
@Schema(description = "The JKS keystore file (Java Key Store)")
|
||||
|
||||
Reference in New Issue
Block a user