diff --git a/maxkey-core/src/test/java/org/maxkey/crypto/cert/X509V3CertGenTest.java b/maxkey-core/src/test/java/org/maxkey/crypto/cert/X509V3CertGenTest.java index cd22c41084215ac22a47ade3fb9a570652574667..5cc42df2fb91354b11d744052d776e39e1bef2a1 100644 --- a/maxkey-core/src/test/java/org/maxkey/crypto/cert/X509V3CertGenTest.java +++ b/maxkey-core/src/test/java/org/maxkey/crypto/cert/X509V3CertGenTest.java @@ -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(); diff --git a/maxkey-persistence/src/test/resources/spring/applicationContext.xml b/maxkey-persistence/src/test/resources/spring/applicationContext.xml index 3dbc04a4976c632485a5699d99e97159538d2daa..8813a3b274d96f2bc44a562fa1527a033a08e2ff 100644 --- a/maxkey-persistence/src/test/resources/spring/applicationContext.xml +++ b/maxkey-persistence/src/test/resources/spring/applicationContext.xml @@ -52,6 +52,10 @@ + + + +