Add CI/CD tests using Github Actions.

The tests compile and run the applet in the jcardsim Javacard simulator.
ECDSA signature tests are performed using OpenPGPpy, other tests such as
AES are performed using the local bin/smartpgp-cli script.

TODO: add tests for RSA, asymmetric encryption, pin modifications, secure
messaging (if well supported by jcardsim), etc.
This commit is contained in:
Ryad Benadjila
2021-03-25 10:38:27 +01:00
committed by Arnaud Fontaine
parent 4fbafe513b
commit 0b43929a83
6 changed files with 316 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
diff --git a/src/main/java/com/licel/jcardsim/crypto/SecureRandomNullProvider.java b/src/main/java/com/licel/jcardsim/crypto/SecureRandomNullProvider.java
index f4cca44..70d41a3 100644
--- a/src/main/java/com/licel/jcardsim/crypto/SecureRandomNullProvider.java
+++ b/src/main/java/com/licel/jcardsim/crypto/SecureRandomNullProvider.java
@@ -32,7 +32,14 @@ class SecureRandomNullProvider extends SecureRandom {
}
@Override
protected void engineNextBytes(byte[] arg) {
- engine.nextBytes(arg);
+ final String doSecureRandom = System.getProperty("com.licel.jcardsim.randomdata.secure", "0");
+ if ("1".equals(doSecureRandom)){
+ SecureRandom randomGenerator = new SecureRandom();
+ randomGenerator.nextBytes(arg);
+ }
+ else{
+ engine.nextBytes(arg);
+ }
}
@Override
protected byte[] engineGenerateSeed(int len) {