File tree 5 files changed +11
-13
lines changed
5 files changed +11
-13
lines changed Original file line number Diff line number Diff line change 5
5
<groupId >com.github.martinpaljak</groupId >
6
6
<artifactId >cdoc4j</artifactId >
7
7
<packaging >jar</packaging >
8
- <version >0.0.5 </version >
8
+ <version >0.0.6 </version >
9
9
<name >cdoc4j</name >
10
10
<description >Java library for handling CDOC 1.0/1.1/2.0 files with AES-256 GCM and RSA or ECC recipients
11
11
</description >
Original file line number Diff line number Diff line change @@ -168,13 +168,6 @@ public boolean check(List<String> errors) throws IOException {
168
168
return true ;
169
169
}
170
170
171
- /**
172
- * Get a file from the container with the given path.
173
- *
174
- * @param name path of the file in zip container
175
- * @return bytes of the file
176
- * @throws IOException
177
- */
178
171
public byte [] get (String name ) throws IOException {
179
172
ZipEntry ze = zf .getEntry (name );
180
173
if (ze == null )
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ public static List<Node> asList(NodeList n) {
148
148
}
149
149
150
150
public static boolean validate_cdoc (byte [] d ) throws IOException {
151
- try (InputStream schema = XML .class .getResourceAsStream ("xenc-schema.xsd" )) {
151
+ try (InputStream schema = XML .class .getResourceAsStream ("xenc-schema-11 .xsd" )) {
152
152
return validate (d , schema );
153
153
}
154
154
}
Original file line number Diff line number Diff line change
1
+ package org .cdoc4j ;
2
+
1
3
import org .apache .commons .io .IOUtils ;
2
- import org .cdoc4j .*;
3
4
import org .esteid .hacker .FakeEstEIDCA ;
4
5
import org .junit .*;
5
6
import org .junit .rules .TestName ;
@@ -37,13 +38,13 @@ public class TestEncryptDummy {
37
38
public static void resources () throws Exception {
38
39
// Extract resource
39
40
dummy = Files .createTempFile (null , null );
40
- IOUtils .copy (TestEncryptDummy .class .getResourceAsStream ("CDOC-A-101-7.pdf" ), Files .newOutputStream (dummy ));
41
+ IOUtils .copy (TestEncryptDummy .class .getResourceAsStream ("/ CDOC-A-101-7.pdf" ), Files .newOutputStream (dummy ));
41
42
System .out .println ("Input file sizes: " + (Files .size (dummy )));
42
43
43
44
// Parse certificates
44
45
CertificateFactory cf = CertificateFactory .getInstance ("X509" );
45
- ecc = (X509Certificate ) cf .generateCertificate (TestEncryptDummy .class .getResourceAsStream ("sk-auth-ecc.pem" ));
46
- rsa = (X509Certificate ) cf .generateCertificate (TestEncryptDummy .class .getResourceAsStream ("sk-auth.pem" ));
46
+ ecc = (X509Certificate ) cf .generateCertificate (TestEncryptDummy .class .getResourceAsStream ("/ sk-auth-ecc.pem" ));
47
+ rsa = (X509Certificate ) cf .generateCertificate (TestEncryptDummy .class .getResourceAsStream ("/ sk-auth.pem" ));
47
48
}
48
49
49
50
@ Before
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ public void testV20RSA() throws Exception {
173
173
CDOCBuilder creator = new CDOCBuilder (CDOC .VERSION .CDOC_V2_0 );
174
174
creator .addStream (HELLONAME , new ByteArrayInputStream (helloWorld ));
175
175
creator .addRecipient (rsacertificate );
176
+ creator .withValidation (true );
176
177
creator .setOutputStream (mem );
177
178
creator .build ();
178
179
@@ -195,6 +196,7 @@ public void testV20Combined() throws Exception {
195
196
creator .addRecipient (rsacertificate );
196
197
creator .addRecipient (ecccertificate );
197
198
199
+ creator .withValidation (true );
198
200
creator .setOutputStream (mem );
199
201
creator .build ();
200
202
@@ -219,6 +221,8 @@ public void testZipOutputStream() throws Exception {
219
221
CDOCBuilder creator = new CDOCBuilder (VERSION .CDOC_V2_0 );
220
222
creator .addRecipient (ecccertificate );
221
223
creator .setOutputStream (mem );
224
+ creator .withPrivacy (true );
225
+ creator .withValidation (true );
222
226
try (ZipOutputStream zos = creator .buildZipOutputStream ()) {
223
227
zos .putNextEntry (new ZipEntry (HELLONAME ));
224
228
zos .write (helloWorld );
You can’t perform that action at this time.
0 commit comments