code: public static Map<String, String> getKeys() throws Exception {
  		KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM);
  		keyPairGen.initialize(1024);
  		KeyPair keyPair = keyPairGen.generateKeyPair();
  		RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
  		RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
  
  		String publicKeyStr = getPublicKeyStr(publicKey);
  		String privateKeyStr = getPrivateKeyStr(privateKey);
  
  		Map<String, String> map = new HashMap<String, String>();
  		map.put("publicKey", publicKeyStr);
  		map.put("privateKey", privateKeyStr);
  
  		System.out.println("公钥\r\n" + publicKeyStr);
  		System.out.println("私钥\r\n" + privateKeyStr);
  		return map;
  	}
docs: 生成公钥和私钥
  
  @throws Exception