diff options
-rw-r--r-- | pdf-as-common/src/main/resources/resources/messages/common.properties | 2 | ||||
-rw-r--r-- | signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/pdf-as-common/src/main/resources/resources/messages/common.properties b/pdf-as-common/src/main/resources/resources/messages/common.properties index 3e7f3d55..89eb05ef 100644 --- a/pdf-as-common/src/main/resources/resources/messages/common.properties +++ b/pdf-as-common/src/main/resources/resources/messages/common.properties @@ -38,7 +38,7 @@ error.pdf.sig.09=Signature profile %s not available error.pdf.sig.10=No signature data available error.pdf.sig.11=No data sink available error.pdf.sig.12=Document is protected - +error.pdf.sig.13=Invalid Alias for Keystore Entry #Signature verification errors error.pdf.verify.01=No signed data available diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java index 758e98dd..7772fd3a 100644 --- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java @@ -77,6 +77,9 @@ public class PAdESSignerKeystore implements IPlainSigner { KeyStore ks = KeyStore.getInstance(type); ks.load(new FileInputStream(file), kspassword.toCharArray()); privKey = (PrivateKey) ks.getKey(alias, keypassword.toCharArray()); + if(privKey == null) { + throw new PdfAsException("error.pdf.sig.13"); + } cert = new X509Certificate(ks.getCertificate(alias).getEncoded()); } catch (Throwable e) { throw new PdfAsException("error.pdf.sig.02", e); |