Skip to content

Commit

Permalink
Merge pull request #24 from eu-digital-green-certificates/fix/non-nam…
Browse files Browse the repository at this point in the history
…ed-curves

Fix: Add Support for Unnamed Curves for EC Public Keys
  • Loading branch information
f11h authored Jan 21, 2022
2 parents 1342910 + cd792bd commit 957a10e
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 33 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.plugin-version>3.8.1</maven.compiler.plugin-version>
<dgclib.version>1.1.2</dgclib.version>
<dgclib.version>1.1.9</dgclib.version>
<plugin.checkstyle.version>3.1.2</plugin.checkstyle.version>
<plugin.license.version>2.0.0</plugin.license.version>
<owasp.version>6.1.1</owasp.version>
<owasp.version>6.5.2</owasp.version>
<!-- license -->
<license.projectName>EU Digital Green Certificate Gateway Service / dgc-cli</license.projectName>
<license.inceptionYear>2021</license.inceptionYear>
Expand Down Expand Up @@ -57,7 +57,7 @@
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.6.1</version>
<version>4.6.2</version>
</dependency>
<dependency>
<groupId>eu.europa.ec.dgc</groupId>
Expand All @@ -77,7 +77,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
<version>1.7.32</version>
</dependency>

</dependencies>
Expand Down Expand Up @@ -116,7 +116,7 @@
<path>
<groupId>info.picocli</groupId>
<artifactId>picocli-codegen</artifactId>
<version>4.6.1</version>
<version>4.6.2</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/europa/ec/dgc/cli/DgcCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/europa/ec/dgc/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/eu/europa/ec/dgc/cli/VersionProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,7 +38,7 @@ public String[] getVersion() throws Exception {

properties.load(inputStream);

return new String[] {
return new String[]{
"DGC CLI Version: " + properties.getProperty(dgcCliVersionProperty, "unknown version"),
"Based on DGC LIB Version:" + properties.getProperty(dgcLibVersionProperty, "unknown version")
};
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/europa/ec/dgc/cli/signing/SignCert.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/eu/europa/ec/dgc/cli/signing/SignString.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,10 +23,8 @@
import static eu.europa.ec.dgc.cli.utils.CliUtils.readCertFromFile;
import static eu.europa.ec.dgc.cli.utils.CliUtils.readKeyFromFile;

import eu.europa.ec.dgc.signing.SignedCertificateMessageBuilder;
import eu.europa.ec.dgc.signing.SignedStringMessageBuilder;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/europa/ec/dgc/cli/signing/Signing.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
12 changes: 1 addition & 11 deletions src/main/java/eu/europa/ec/dgc/cli/trustanchor/Sign.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,22 +26,12 @@
import eu.europa.ec.dgc.signing.SignedCertificateMessageBuilder;
import eu.europa.ec.dgc.utils.CertificateUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Base64;
import java.util.concurrent.Callable;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.asn1.x509.X509ObjectIdentifiers;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import picocli.CommandLine;

@CommandLine.Command(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/eu/europa/ec/dgc/cli/utils/CliUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ---license-start
* EU Digital Green Certificate Gateway Service / dgc-cli
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* Copyright (C) 2021 - 2022 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -27,9 +27,9 @@
import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.jcajce.provider.asymmetric.x509.CertificateFactory;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;

Expand Down Expand Up @@ -57,14 +57,14 @@ public static PrivateKey readKeyFromFile(File inputFile) throws IOException {
*
* @param inputFile the file to read from.
* @return Read Certificate
* @throws IOException if reading failed.
* @throws IOException if reading failed.
* @throws CertificateException if certificate parsing failed.
*/
public static X509Certificate readCertFromFile(File inputFile) throws IOException, CertificateException {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
CertificateFactory certificateFactory = new CertificateFactory();

FileInputStream fileInputStream = new FileInputStream(inputFile);
Certificate inputCert = certificateFactory.generateCertificate(fileInputStream);
Certificate inputCert = certificateFactory.engineGenerateCertificate(fileInputStream);
fileInputStream.close();

if (inputCert instanceof X509Certificate) {
Expand Down

0 comments on commit 957a10e

Please sign in to comment.