@Test public void testGetPublicKey() throws Exception { KeyPair kp = RSAUtil.getKeyPair("e:\\RSAKey.txt"); String publicKey = RSAUtil.getPublicKey(kp); System.out.println("公钥：" + publicKey); }
public static String getPublicKey(KeyPair keyPair) { Key publicKey = keyPair.getPublic(); return Base64.encodeBase64URLSafeString(publicKey.getEncoded()); }
RSAUtil { public static String getPublicKey(KeyPair keyPair) { Key publicKey = keyPair.getPublic(); return Base64.encodeBase64URLSafeString(publicKey.getEncoded()); } }
RSAUtil { public static String getPublicKey(KeyPair keyPair) { Key publicKey = keyPair.getPublic(); return Base64.encodeBase64URLSafeString(publicKey.getEncoded()); }  }
RSAUtil { public static String getPublicKey(KeyPair keyPair) { Key publicKey = keyPair.getPublic(); return Base64.encodeBase64URLSafeString(publicKey.getEncoded()); }  static KeyPair generateKeyPair(int keySize); static Map<String, String> createKeys(int keySize); static String getPublicKey(KeyPair keyPair); static String getPrivateKey(KeyPair keyPair); static KeyPair getKeyPair(String filePath); static void saveKeyPair(KeyPair kp, String filePath); static String decryptString(String plaintext, String privateKey); static String encryptString(String plaintext, String publicKey); static RSAPublicKey getPublicKey(String publicKey); static RSAPrivateKey getPrivateKey(String privateKey); static String publicEncrypt(String plaintext, RSAPublicKey publicKey); static String privateDecrypt(String plaintext, RSAPrivateKey privateKey); }
RSAUtil { public static String getPublicKey(KeyPair keyPair) { Key publicKey = keyPair.getPublic(); return Base64.encodeBase64URLSafeString(publicKey.getEncoded()); }  static KeyPair generateKeyPair(int keySize); static Map<String, String> createKeys(int keySize); static String getPublicKey(KeyPair keyPair); static String getPrivateKey(KeyPair keyPair); static KeyPair getKeyPair(String filePath); static void saveKeyPair(KeyPair kp, String filePath); static String decryptString(String plaintext, String privateKey); static String encryptString(String plaintext, String publicKey); static RSAPublicKey getPublicKey(String publicKey); static RSAPrivateKey getPrivateKey(String privateKey); static String publicEncrypt(String plaintext, RSAPublicKey publicKey); static String privateDecrypt(String plaintext, RSAPrivateKey privateKey); static final String PUBLIC_KEY; static final String PRIVATE_KEY; static final String CHARSET; static final int KEY_SIZE; }