From e64b4c6f49127c18ccfadcc9d485b5e306f671e8 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Fri, 22 Aug 2014 09:04:45 +0200 Subject: better error message when keystore alias is wrong --- .../src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'signature-standards') 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); -- cgit v1.2.3