Skip to content

Commit 4122319

Browse files
committed
Merge branch 'RM-3032' into 'master'
RM-3032: replace real ID codes with test person ID code See merge request cdoc2/cdoc2-java-ref-impl!48
2 parents 1e0c0f4 + ec97619 commit 4122319

File tree

7 files changed

+27
-21
lines changed

7 files changed

+27
-21
lines changed

cdoc2-cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ To store keys in key server, specify addition `--server` option:
4343

4444
When encrypting for est-eid card, `-r` <id-code> can be used
4545
```
46-
java -jar target/cdoc2-cli-*.jar create --server=config/localhost/localhost.properties -f /tmp/localhost_id-card.cdoc -r 37903130370 README.md
46+
java -jar target/cdoc2-cli-*.jar create --server=config/localhost/localhost.properties -f /tmp/localhost_id-card.cdoc -r 38001085718 README.md
4747
```
4848

4949
Optionally cdoc2-cli also supports encrypting with "soft" key or certificate

cdoc2-cli/config/localhost/localhost.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Client configuration where keys and certificates are read from smart-card (PKCS11 configuration)
2-
# java -jar target/cdoc2-cli-0.0.12-SNAPSHOT.jar create --server=config/localhost/localhost.properties -f /tmp/localhost_id-card.cdoc -r 37903130370 README.md
2+
# java -jar target/cdoc2-cli-0.0.12-SNAPSHOT.jar create --server=config/localhost/localhost.properties -f /tmp/localhost_id-card.cdoc -r 38001085718 README.md
33

44
# java -jar target/cdoc2-cli-0.0.10-SNAPSHOT.jar decrypt --server=config/localhost/localhost.properties -f /tmp/localhost_id-card.cdoc -o /tmp/
55

cdoc2-cli/config/ria-dev/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Run from cdoc2-cli directory
1212

1313
### Encrypt for id-card
1414
```
15-
java -jar target/cdoc2-cli-*.jar create --server=config/ria-dev/ria-dev.properties -f /tmp/ria.cdoc -r 37903130370 README.md
15+
java -jar target/cdoc2-cli-*.jar create --server=config/ria-dev/ria-dev.properties -f /tmp/ria.cdoc -r 38001085718 README.md
1616
```
1717

1818
### Decrypting with id-card

cdoc2-cli/config/ria-test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Run from cdoc2-cli directory
1212

1313
### Encrypt for id-card
1414
```
15-
java -jar target/cdoc2-cli-*.jar create --server=config/ria-test/ria-test.properties -f /tmp/ria.cdoc -r 37903130370 README.md
15+
java -jar target/cdoc2-cli-*.jar create --server=config/ria-test/ria-test.properties -f /tmp/ria.cdoc -r 38001085718 README.md
1616
```
1717

1818
### Decrypting with id-card

cdoc2-lib/ldap.README

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
ldapsearch -H ldaps://esteid.ldap.sk.ee/ -x -b "c=EE" "(cn=KUSMAN,JANNO,37903130370)"
1+
# 38001085718 is a test person and his cert is not available in SK Ldap. Use own ID code instead
2+
# with cn=<your_surname,you_name,you_id_code>
23

3-
ldapsearch -H ldaps://esteid.ldap.sk.ee/ -x -b "dc=ESTEID,c=EE" "(serialNumber=PNOEE-38207162766)"
4+
ldapsearch -H ldaps://esteid.ldap.sk.ee/ -x -b "c=EE" "(cn=JÕEORG,JAAK-KRISTJAN,38001085718)"
5+
6+
ldapsearch -H ldaps://esteid.ldap.sk.ee/ -x -b "dc=ESTEID,c=EE" "(serialNumber=PNOEE-38001085718)"
47

58
Certificate type (digi-id vs id-kaart)
69
https://github.com/open-eid/DigiDoc4-Client/blob/f4298ad9d2fbb40cffc488bed6cf1d3116dff450/client/SslCertificate.cpp#L302
710
https://github.com/open-eid/DigiDoc4-Client/blob/master/client/dialogs/AddRecipients.cpp#L474
811

9-
ldapsearch -H ldaps://esteid.ldap.sk.ee/ -x -b "dc=ESTEID,c=EE" "(serialNumber=PNOEE-38207162766)"
12+
ldapsearch -H ldaps://esteid.ldap.sk.ee/ -x -b "dc=ESTEID,c=EE" "(serialNumber=PNOEE-38001085718)"

cdoc2-lib/pkcs11.README

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@ CKA_TOKEN = false
1515
}
1616

1717

18-
19-
20-
2118
pkcs15-tool --dump
2219

2320

24-
2521
keytool
2622
-providerclass sun.security.pkcs11.SunPKCS11
2723
-providerarg /etc/opensc/opensc-java.cfg
@@ -49,10 +45,10 @@ flags: CKF_TOKEN_PRESENT | CKF_REMOVABLE_DEVICE | CKF_HW_SLOT
4945
hardwareVersion: 0.00
5046
firmwareVersion: 0.00
5147
Token info for token in slot 0:
52-
label: KUSMAN,JANNO,37903130370 (PIN1)
48+
label: JÕEORG,JAAK-KRISTJAN,38001085718 (PIN1)
5349
manufacturerID: IDEMIA
5450
model: PKCS#15 emulated
55-
serialNumber: AB0584325
51+
serialNumber: 38001085718
5652
flags: CKF_WRITE_PROTECTED | CKF_LOGIN_REQUIRED | CKF_USER_PIN_INITIALIZED | CKF_TOKEN_INITIALIZED
5753
ulMaxSessionCount: CK_EFFECTIVELY_INFINITE
5854
ulSessionCount: 0
@@ -162,8 +158,3 @@ Your keystore contains 1 entry
162158

163159
Isikutuvastus, PrivateKeyEntry,
164160
Certificate fingerprint (SHA-256): F2:5F:A3:E8:D0:6C:ED:AE:5D:11:77:C1:35:A2:F3:07:42:9B:4D:3A:3C:E9:B6:EC:7F:3A:E3:F9:6A:76:35:01
165-
166-
167-
168-
169-

cdoc2-lib/src/test/java/ee/cyber/cdoc2/SkLdapTest.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,36 @@
99
import java.util.Map;
1010
import java.util.stream.Collectors;
1111
import javax.naming.NamingException;
12+
13+
import org.junit.jupiter.api.Disabled;
1214
import org.junit.jupiter.api.Tag;
1315
import org.junit.jupiter.api.Test;
1416
import org.slf4j.Logger;
1517
import org.slf4j.LoggerFactory;
1618
import static org.junit.jupiter.api.Assertions.assertEquals;
1719
import static org.junit.jupiter.api.Assertions.assertFalse;
20+
import static org.junit.jupiter.api.Assertions.assertThrows;
1821

1922

2023
class SkLdapTest {
2124
private static final Logger log = LoggerFactory.getLogger(SkLdapTest.class);
2225

23-
// Igor cert is not available from SKs
24-
//private static final String id = "37101010021";//Igor
26+
@Test
27+
@Tag("ldap")
28+
void shouldFailToFindMissingAuthenticationCert() {
29+
// JAAK-KRISTJAN JÕEORG 38001085718 cert is not available from SK Ldap as he is a test
30+
// person and SK doesn't have test LDAP environment.
31+
String[] ids = new String[]{"38001085718"};
32+
assertThrows(CertificateException.class, () -> SkLdapUtil.getPublicKeysWithLabels(ids));
33+
}
2534

2635
@Test
2736
@Tag("ldap")
37+
@Disabled("Requires real ID code. As 38001085718 code is for test person - its certificate"
38+
+ " is not available from SK LDAP. Needs to be run separately from other LDAP tests"
39+
+ " with own ID code")
2840
void testFindAuthenticationCerts() throws NamingException, CertificateException {
29-
String[] ids = new String[]{"37903130370", "38207162766"};
41+
String[] ids = new String[]{"38001085718"}; // replace with own ID code for testing
3042
List<SkLdapUtil.CertificateData> keysWithLabels = SkLdapUtil.getPublicKeysWithLabels(ids);
3143

3244
// Since testing against external service, then can't be really sure what is returned

0 commit comments

Comments
 (0)