Skip to content

Commit

Permalink
修改jdchain-cli打包
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzhiyong69 committed Dec 31, 2021
1 parent 3679b86 commit 7d649ae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
6 changes: 6 additions & 0 deletions tools/tools-jdchain-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
<classpathPrefix>../libs</classpathPrefix>
<useUniqueVersions>false</useUniqueVersions>
</manifest>
<manifestEntries>
<Class-Path>../libs/gmssl_ah-1.0-SNAPSHOT.jar ../libs/gmssl_provider.jar</Class-Path>
</manifestEntries>
<!-- <manifestEntries>-->
<!-- <Class-Path>../libs/gmssl_provider.jar</Class-Path>-->
<!-- </manifestEntries>-->
</archive>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.jd.blockchain.tools.cli;

import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.jd.blockchain.ca.CertificateRole;
import com.jd.blockchain.ca.CertificateUsage;
Expand Down Expand Up @@ -38,13 +39,10 @@
import picocli.CommandLine;
import utils.StringUtils;
import utils.certs.CertsHelper;
import utils.certs.SM2Util;
import utils.certs.SmCertMarker;
import utils.io.FileUtils;

import java.io.*;
import java.math.BigInteger;
import java.security.KeyPair;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.PublicKey;
Expand Down Expand Up @@ -484,6 +482,9 @@ class CATest implements Runnable {
@CommandLine.Option(names = "--email", required = true, description = "Email address")
String email;

@CommandLine.Option(names = "--out", required = false, description = "certs out path")
String outPath;

@CommandLine.ParentCommand
private CA caCli;

Expand All @@ -500,21 +501,27 @@ public void run() {
}

if ("GMSSL".equalsIgnoreCase(algorithm)) {

String sm2CertsOutPath = caCli.getCaHome() + File.separator + "sm2";
if(!Strings.isNullOrEmpty(outPath)){
sm2CertsOutPath = outPath;
}

//生成国密测试证书
File gmsslHome = new File(caCli.getCaHome() + File.separator + "sm2");
File gmsslHome = new File(sm2CertsOutPath);
gmsslHome.mkdirs();

long expireTime = 10L * 365 * 24 * 60 * 60 * 1000;

CertsHelper.buildSMCaTestCerts(gmsslHome, nodes, gws, users, expireTime, password,
CertsHelper.makeSMCaTestCerts(gmsslHome, nodes, gws, users, expireTime, password,
ImmutableMap.of(BCStyle.O, organization,
BCStyle.C, country,
BCStyle.ST, province,
BCStyle.L, locality,
BCStyle.EmailAddress, email
));

System.out.println("create test gmssl certificates in [" + caCli.getCaHome() + "] success");
System.out.println("create test gmssl certificates in [" + gmsslHome.getAbsolutePath() + "] success");
return;
}

Expand Down

0 comments on commit 7d649ae

Please sign in to comment.