aboutsummaryrefslogtreecommitdiff
path: root/signature-standards/sigs-pades/src/main/java
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-08-22 09:04:45 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-08-22 09:04:45 +0200
commite64b4c6f49127c18ccfadcc9d485b5e306f671e8 (patch)
tree192d8476d54050a5ee6060256901db5c97cf1bf8 /signature-standards/sigs-pades/src/main/java
parent124cfd630280424aea1df428386bcbc6f552acad (diff)
downloadpdf-as-4-e64b4c6f49127c18ccfadcc9d485b5e306f671e8.tar.gz
pdf-as-4-e64b4c6f49127c18ccfadcc9d485b5e306f671e8.tar.bz2
pdf-as-4-e64b4c6f49127c18ccfadcc9d485b5e306f671e8.zip
better error message when keystore alias is wrong
Diffstat (limited to 'signature-standards/sigs-pades/src/main/java')
-rw-r--r--signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java3
1 files changed, 3 insertions, 0 deletions
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);