Skip to content

Commit

Permalink
✨ feat: 添加 BootApplicationTest 测试类,生成 RSA 密钥对
Browse files Browse the repository at this point in the history
  • Loading branch information
vnobo committed Sep 9, 2024
1 parent 9c06d0f commit 4dbdce1
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.plate.boot;

import org.junit.jupiter.api.Test;

import java.security.*;

/**
* @author <a href="https://github.com/vnobo">Alex Bob</a>
*/
class BootApplicationTest {

@Test
void contextLoads() throws NoSuchAlgorithmException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(2048);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
PrivateKey privateKey = keyPair.getPrivate();
PublicKey publicKey = keyPair.getPublic();
System.out.println(privateKey);
System.out.println(publicKey);
}
}

0 comments on commit 4dbdce1

Please sign in to comment.