mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 20:50:14 +08:00
run @Test
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
package org.maxkey.crypto.cert;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.security.KeyPair;
|
||||
import java.security.Security;
|
||||
@@ -33,15 +34,20 @@ public class X509V3CertGenTest {
|
||||
public void generateV3() throws Exception {
|
||||
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
|
||||
KeyPair keyPair =X509V3CertGen.genRSAKeyPair();
|
||||
String issuer="CN=connsec.com,O=connsec,L=SH,ST=SH,C=CN";
|
||||
String issuer="CN=maxkey.top,O=maxkey,L=SH,ST=SH,C=CN";
|
||||
Date startDate=DateTime.now().toDate();
|
||||
Date endDate=DateTime.now().plusMonths(10).toDate();
|
||||
System.out.println("Private : "+ keyPair.getPrivate().toString());
|
||||
|
||||
System.out.println("Public : "+ keyPair.getPublic().toString());
|
||||
X509Certificate cert = X509V3CertGen.genV3Certificate(issuer,issuer,startDate,endDate,keyPair);
|
||||
|
||||
FileOutputStream out = new FileOutputStream("c:\\Cert345.cer");
|
||||
String certFileString = "D:\\MaxKey\\Workspaces\\maxkey\\Cert345.cer";
|
||||
File certFile =new File(certFileString);
|
||||
if(certFile.exists()) {
|
||||
certFile.deleteOnExit();
|
||||
}
|
||||
|
||||
FileOutputStream out = new FileOutputStream(certFileString);
|
||||
out.write(cert.getEncoded());
|
||||
out.close();
|
||||
|
||||
|
||||
@@ -52,6 +52,10 @@
|
||||
<bean id="characterEncodingConfig" class="org.maxkey.configuration.CharacterEncodingConfig"></bean>
|
||||
<bean id="loginConfig" class="org.maxkey.configuration.LoginConfig"></bean>
|
||||
|
||||
<bean id="passwordPolicyValidator" class="org.maxkey.persistence.db.PasswordPolicyValidator">
|
||||
|
||||
</bean>
|
||||
|
||||
<bean id="producerProperties" class="java.util.HashMap">
|
||||
<constructor-arg>
|
||||
<map>
|
||||
|
||||
Reference in New Issue
Block a user