code: private static String[] commonKey(int size) throws NoSuchAlgorithmException {
          String [] keys = new String[2];
  
          KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(RSA);
          keyPairGenerator.initialize(size);
          KeyPair keyPair = keyPairGenerator.generateKeyPair();
          RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
          RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
  
          // 私钥
          keys[0] = Base64.byteArrayToBase64(rsaPrivateKey.getEncoded());
          // 公钥
          keys[1] = Base64.byteArrayToBase64(rsaPublicKey.getEncoded());
  
          return keys;
      }
docs: (common)获取密钥