diff options
author | ferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-11-13 12:34:37 +0000 |
---|---|---|
committer | ferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-11-13 12:34:37 +0000 |
commit | aa2eda4665a36658aca594aba69acd285700e9ef (patch) | |
tree | c0a587d56133ee0d336e73cb73f997bcc289b427 /src/main/java/at/gv/egiz | |
parent | f923b21538862a7b308231bbcdf63b86f99e2eb8 (diff) | |
download | pdf-as-3-aa2eda4665a36658aca594aba69acd285700e9ef.tar.gz pdf-as-3-aa2eda4665a36658aca594aba69acd285700e9ef.tar.bz2 pdf-as-3-aa2eda4665a36658aca594aba69acd285700e9ef.zip |
added /alg BAIK support
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@386 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz')
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/algorithmSuite/AlgorithmSuiteUtil.java | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/algorithmSuite/AlgorithmSuiteUtil.java b/src/main/java/at/gv/egiz/pdfas/algorithmSuite/AlgorithmSuiteUtil.java index 0ab9729..81fe2c0 100644 --- a/src/main/java/at/gv/egiz/pdfas/algorithmSuite/AlgorithmSuiteUtil.java +++ b/src/main/java/at/gv/egiz/pdfas/algorithmSuite/AlgorithmSuiteUtil.java @@ -35,19 +35,34 @@ public class AlgorithmSuiteUtil { String verify_template = environment.getVerifyTemplate();
- String cert_alg;
+ String cert_alg = null;
String verify_xml = null;
X509Certificate cert = so.getX509Certificate();
String ids_string = so.getSigID();
//AlgorithmSuiteObject algSuite = new AlgorithmSuiteObject(ids_string);
algSuite.parseFrom(ids_string, true);
+ // 1. is specified in sig_id
if (algSuite.isSpecified()) {
log.debug("Algorithm suite defined as parameter. Using new dynamic template replacement.");
- cert_alg = AlgorithmMapper.getUri(algSuite.getSignatureMethod());
-
- } else {
- log.debug("NO algorithm suite defined as parameter. Using old static algorithm.");
+ cert_alg = AlgorithmMapper.getUri(algSuite.getSignatureMethod());
+
+ // 2. is specified in /alg replace -> baik
+ } else if (so.getSigAlgorithm() != null && so.getSigAlgorithm().length() > 0) {
+ String algAbbr = AlgorithmMapper.getAbbreviation(so.getSigAlgorithm());
+ algSuite.parseFrom(algAbbr, false);
+
+ if (algSuite.isSpecified()) {
+ log.debug("Algorithm /alg available. Using: " + so.getSigAlgorithm());
+ cert_alg = AlgorithmMapper.getUri(algSuite.getSignatureMethod());
+// algSuite.setCertDigestMethod("sha1");
+ //algSuite.setPropertiesDigestMethod("sha1");
+ }
+ }
+
+ // 3. default
+ if (cert_alg == null) {
+ log.debug("NO algorithm suite defined. Using default old static algorithm.");
cert_alg = environment.getCertAlgEcdsa();
if (cert.getPublicKey().getAlgorithm().indexOf("RSA") >= 0) //$NON-NLS-1$
|