Skip to content

Commit 190db1c

Browse files
committed
WIP
1 parent 4397d7b commit 190db1c

4 files changed

Lines changed: 18 additions & 14 deletions

File tree

signing/pom.xml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<version>1.0-SNAPSHOT</version>
1010

1111
<properties>
12-
<maven.compiler.source>25</maven.compiler.source>
13-
<maven.compiler.target>25</maven.compiler.target>
12+
<maven.compiler.source>17</maven.compiler.source>
13+
<maven.compiler.target>17</maven.compiler.target>
1414
</properties>
1515

1616
<dependencies>
@@ -26,9 +26,16 @@
2626
<groupId>org.apache.maven.plugins</groupId>
2727
<artifactId>maven-compiler-plugin</artifactId>
2828
<configuration>
29-
<source>25</source>
30-
<target>25</target>
31-
<compilerArgs>--enable-preview</compilerArgs>
29+
<source>17</source>
30+
<target>17</target>
31+
<!-- <compilerArgs>&#45;&#45;enable-preview</compilerArgs>-->
32+
</configuration>
33+
</plugin>
34+
<plugin>
35+
<groupId>org.codehaus.mojo</groupId>
36+
<artifactId>exec-maven-plugin</artifactId>
37+
<configuration>
38+
<mainClass>playground.stianst.github.io.SignatureTest</mainClass>
3239
</configuration>
3340
</plugin>
3441
</plugins>

signing/src/main/java/playground/stianst/github/io/SignatureAlgorithms.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public enum SignatureAlgorithms {
1616
ES512("SHA512withECDSA", "EC", new ECGenParameterSpec("secp521r1")),
1717
FALCON_512("Falcon", "Falcon", FalconParameterSpec.falcon_512),
1818
FALCON_1024("Falcon", "Falcon", FalconParameterSpec.falcon_1024),
19-
ML_DSA_44("ML-DSA-44", NamedParameterSpec.ML_DSA_44),
20-
ML_DSA_65("ML-DSA-65", NamedParameterSpec.ML_DSA_65),
21-
ML_DSA_87("ML-DSA-87", NamedParameterSpec.ML_DSA_87),
19+
ML_DSA_44("ML-DSA-44", new NamedParameterSpec("ML-DSA-44")),
20+
ML_DSA_65("ML-DSA-65", new NamedParameterSpec("ML-DSA-65")),
21+
ML_DSA_87("ML-DSA-87", new NamedParameterSpec("ML-DSA-87")),
2222
RS256("SHA256withRSA", "RSA", new RSAKeyGenParameterSpec(2048, RSAKeyGenParameterSpec.F4)),
2323
RS384("SHA384withRSA", "RSA", new RSAKeyGenParameterSpec(3072, RSAKeyGenParameterSpec.F4)),
2424
RS512("SHA384withRSA", "RSA", new RSAKeyGenParameterSpec(4096, RSAKeyGenParameterSpec.F4)),

signing/src/main/java/playground/stianst/github/io/SignatureTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import java.nio.charset.StandardCharsets;
66
import java.security.KeyPair;
77
import java.security.KeyPairGenerator;
8-
import java.security.PEMEncoder;
98
import java.security.Security;
109
import java.security.Signature;
1110
import java.util.Base64;
@@ -14,12 +13,12 @@ public class SignatureTest {
1413

1514
public static final String OUTPUT = "%-15s %-12s %-12s %-12s %-12s%n";
1615

17-
static void main(String[] args) throws Exception {
16+
public static void main(String[] args) throws Exception {
1817
Security.addProvider(new BouncyCastleProvider());
1918

2019
String payload = new String(SignatureTest.class.getClassLoader().getResourceAsStream("payload").readAllBytes(), StandardCharsets.UTF_8);
2120
int countFast = 100;
22-
int countSlow = 10;
21+
int countSlow = 1;
2322

2423
System.out.printf(OUTPUT, "Algorithm", "Size", "Size (url)", "Key Size", "Time (ms)");
2524
for (SignatureAlgorithms a : SignatureAlgorithms.values()) {
@@ -41,9 +40,7 @@ static void main(String[] args) throws Exception {
4140
long time = System.currentTimeMillis() - start;
4241
String signatureEncoded = Base64.getUrlEncoder().encodeToString(signedBytes);
4342

44-
byte[] publicKeyEncoded = PEMEncoder.of().encode(keyPair.getPublic());
45-
46-
System.out.printf(OUTPUT, a.getName(), signedBytes.length, signatureEncoded.length(), publicKeyEncoded.length, (double) time / count);
43+
System.out.printf(OUTPUT, a.getName(), signedBytes.length, signatureEncoded.length(), keyPair.getPublic().getEncoded().length, (double) time / count);
4744
}
4845

4946
}
File renamed without changes.

0 commit comments

Comments
 (0)