Skip to content

Commit 079625e

Browse files
Support for @firma 1.5.0
1 parent 48678df commit 079625e

File tree

9 files changed

+809
-369
lines changed

9 files changed

+809
-369
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Windows
3030

3131
Mac OS
3232
* Mozilla Firefox: Applet
33-
* Apple Safari: Applet
33+
* Apple Safari: Local application (currently not working)
3434
* Google Chrome: Local application (currently not working)
3535

3636
Linux Ubuntu
@@ -52,7 +52,7 @@ This module uses a software digital certificate or a cryptographic hardware supp
5252
The plugin is licensed under the [LGPL v3.0](http://www.gnu.org/licenses/lgpl-3.0.html).
5353

5454
**State**
55-
Current addon release 1.3.1 is ***PROD***
55+
Current addon release 1.5.0 is ***PROD***
5656

5757
**Compatibility**
5858
The current version has been developed using Alfresco 5.0.d and Alfresco SDK 2.1.1, although it runs in Alfresco 5.1.x
@@ -69,8 +69,8 @@ Downloading the ready-to-deploy-plugin
6969
--------------------------------------
7070
The binary distribution is made of two amp files:
7171

72-
* [repo AMP](https://github.com/keensoft/alfresco-esign-cert/releases/download/1.3.1/esign-cert-repo.amp)
73-
* [share AMP](https://github.com/keensoft/alfresco-esign-cert/releases/download/1.3.1/esign-cert-share.amp)
72+
* [repo AMP](https://github.com/keensoft/alfresco-esign-cert/releases/download/1.5.0/esign-cert-repo.amp)
73+
* [share AMP](https://github.com/keensoft/alfresco-esign-cert/releases/download/1.5.0/esign-cert-share.amp)
7474

7575
You can install them by using standard [Alfresco deployment tools](http://docs.alfresco.com/community/tasks/dev-extensions-tutorials-simple-module-install-amp.html)
7676

@@ -87,12 +87,12 @@ Signing the applet
8787
------------------
8888
You can download plain applet from http://forja-ctt.administracionelectronica.gob.es/web/clienteafirma
8989

90-
Oracle [jarsigner](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jarsigner.html) can be used to perform a signature on [miniapplet-full_1_4.jar](https://github.com/keensoft/alfresco-esign-cert/raw/master/esign-cert-share/src/main/amp/web/sign/miniapplet-full_1_4.jar). To deploy this change, just replace current JAR for your signed JAR and rebuild the artifacts.
90+
Oracle [jarsigner](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jarsigner.html) can be used to perform a signature on [miniapplet-full_1_4.jar](https://github.com/keensoft/alfresco-esign-cert/raw/master/esign-cert-share/src/main/amp/web/sign/miniapplet-full_1_5.jar). To deploy this change, just replace current JAR for your signed JAR and rebuild the artifacts.
9191

9292
Below a sample `jarsigner` invocation is provided
9393

9494
```
95-
$ jarsigner -storetype pkcs12 -keystore keensoft_sign_code_valid-until_20170811.pfx miniapplet-full_1_4.jar -tsa http://tss.accv.es:8318/tsa te-9b5d5438-2bb6-435f-8542-6d711bc9784f
95+
$ jarsigner -storetype pkcs12 -keystore keensoft_sign_code_valid-until_20170811.pfx miniapplet-full_1_5.jar -tsa http://tss.accv.es:8318/tsa te-9b5d5438-2bb6-435f-8542-6d711bc9784f
9696
```
9797

9898

esign-cert-repo/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>es.keensoft.alfresco</groupId>
66
<artifactId>esign-cert-repo</artifactId>
7-
<version>1.3.1</version>
7+
<version>1.5.0</version>
88
<name>esign-cert-repo Repository AMP project</name>
99
<packaging>amp</packaging>
1010
<description>Manages the lifecycle of the esign-cert-repo Repository AMP (Alfresco Module Package)</description>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package es.keensoft.test;
2+
3+
import java.io.File;
4+
import java.io.FileInputStream;
5+
import java.io.InputStream;
6+
import java.io.Serializable;
7+
import java.security.KeyStore;
8+
import java.security.Provider;
9+
import java.security.cert.X509Certificate;
10+
import java.util.ArrayList;
11+
import java.util.HashMap;
12+
import java.util.Map;
13+
14+
import org.alfresco.service.namespace.QName;
15+
16+
import com.itextpdf.text.pdf.AcroFields;
17+
import com.itextpdf.text.pdf.PdfPKCS7;
18+
import com.itextpdf.text.pdf.PdfReader;
19+
20+
import es.keensoft.alfresco.model.SignModel;
21+
22+
public class PAdESLTV {
23+
24+
public static void main(String... args) throws Exception {
25+
26+
27+
ClassLoader classLoader = PAdESLTV.class.getClassLoader();
28+
File file = new File(classLoader.getResource("PADESLTV.pdf").getFile());
29+
30+
Provider provider = null;
31+
try {
32+
Class c =
33+
Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
34+
java.security.Security.insertProviderAt((java.security.Provider)c.newInstance(), 2000);
35+
//provider = "BC";
36+
provider = (Provider)c.newInstance();
37+
38+
} catch(Exception e) {
39+
provider = null;
40+
// provider is not available }
41+
}
42+
43+
InputStream is = new FileInputStream(file);
44+
45+
PdfReader reader = new PdfReader(is);
46+
AcroFields af = reader.getAcroFields();
47+
ArrayList<String> names = af.getSignatureNames();
48+
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
49+
ks.load(null, null);
50+
ArrayList<Map<QName, Serializable>> aspects = new ArrayList<Map<QName, Serializable>>();
51+
for (String name : names) {
52+
PdfPKCS7 pk = af.verifySignature(name);
53+
X509Certificate certificate = pk.getSigningCertificate();
54+
55+
//Set aspect properties for each signature
56+
Map<QName, Serializable> aspectSignatureProperties = new HashMap<QName, Serializable>();
57+
if (pk.getSignDate() != null) aspectSignatureProperties.put(SignModel.PROP_DATE, pk.getSignDate().getTime());
58+
aspectSignatureProperties.put(SignModel.PROP_CERTIFICATE_PRINCIPAL, certificate.getSubjectX500Principal().toString());
59+
aspectSignatureProperties.put(SignModel.PROP_CERTIFICATE_SERIAL_NUMBER, certificate.getSerialNumber().toString());
60+
aspectSignatureProperties.put(SignModel.PROP_CERTIFICATE_NOT_AFTER, certificate.getNotAfter());
61+
aspectSignatureProperties.put(SignModel.PROP_CERTIFICATE_ISSUER, certificate.getIssuerX500Principal().toString());
62+
aspects.add(aspectSignatureProperties);
63+
}
64+
65+
System.out.println(aspects);
66+
67+
68+
}
69+
70+
}
Binary file not shown.

esign-cert-share/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>es.keensoft.alfresco</groupId>
66
<artifactId>esign-cert-share</artifactId>
7-
<version>1.3.1</version>
7+
<version>1.5.0</version>
88
<name>esign-cert-share AMP project</name>
99
<packaging>amp</packaging>
1010
<description>Manages the lifecycle of the esign-cert-share AMP (Alfresco Module Package)</description>
@@ -113,4 +113,4 @@
113113
</dependencies>
114114
</profile>
115115
</profiles>
116-
</project>
116+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
// Este fichero sirve unicamente para la ejecucion de las paginas de pruebas. No es necesario su uso en
3+
// el despliegue de las aplicaciones de produccion.
4+
var Constants = {
5+
6+
// IMPORTANTE: PARA PRUEBAS, USAR SIEMPRE UNA IP O NOMBRE DE DOMINIO, NUNCA 'LOCALHOST' O '127.0.0.1'
7+
// SI NO SE HACE ASI, AUTOFIRMA BLOQUEARA LA FIRMA POR SEGURIDAD
8+
9+
// URL raiz en la que se encuentra el fichero miniapplet-full_1_5.jar
10+
URL_BASE_APPLE : "http://XXX:8080/miniapplet",
11+
12+
// URL raiz en la que se despliegan los servicios
13+
URL_BASE_SERVICES : "http://XXX:8080"
14+
};
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)