public static KeyPair generateKeyPair(String algorithm, int keySize, byte[] seed, AlgorithmParameterSpec... params) {
		algorithm = getAlgorithmAfterWith(algorithm);
		final KeyPairGenerator keyPairGen = getKeyPairGenerator(algorithm);

		// 密钥模（modulus ）长度初始化定义
		if (keySize > 0) {
			// key长度适配修正
			if ("EC".equalsIgnoreCase(algorithm) && keySize > 256) {
				// 对于EC算法，密钥长度有限制，在此使用默认256
				keySize = 256;
			}
			if (null != seed) {
				keyPairGen.initialize(keySize, new SecureRandom(seed));
			} else {
				keyPairGen.initialize(keySize);
			}
		}

		// 自定义初始化参数
		if (ArrayUtil.isNotEmpty(params)) {
			for (AlgorithmParameterSpec param : params) {
				if (null == param) {
					continue;
				}
				try {
					if (null != seed) {
						keyPairGen.initialize(param, new SecureRandom(seed));
					} else {
						keyPairGen.initialize(param);
					}
				} catch (InvalidAlgorithmParameterException e) {
					throw new CryptoException(e);
				}
			}
		}
		return keyPairGen.generateKeyPair();
	}
public static KeyPair generateKeyPair ( String algorithm , int keySize , byte [ ] seed , AlgorithmParameterSpec ... params ) { algorithm = getAlgorithmAfterWith ( algorithm ) ; final KeyPairGenerator keyPairGen = getKeyPairGenerator ( algorithm ) ; if ( keySize > 0 ) { if ( "EC" . equalsIgnoreCase ( algorithm ) && keySize > 256 ) { keySize = 256 ; } if ( null != seed ) { keyPairGen . initialize ( keySize , new SecureRandom ( seed ) ) ; } else { keyPairGen . initialize ( keySize ) ; } } if ( ArrayUtil . isNotEmpty ( params ) ) { for ( AlgorithmParameterSpec param : params ) { if ( null == param ) { continue ; } try { if ( null != seed ) { keyPairGen . initialize ( param , new SecureRandom ( seed ) ) ; } else { keyPairGen . initialize ( param ) ; } } catch ( InvalidAlgorithmParameterException e ) { throw new CryptoException ( e ) ; } } } return keyPairGen . generateKeyPair ( ) ; }
生成用于非对称加密的公钥和私钥<br>
密钥对生成算法见：https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator

@param algorithm 非对称加密算法
@param keySize 密钥模（modulus ）长度
@param seed 种子
@param params {@link AlgorithmParameterSpec}
@return {@link KeyPair}
@since 4.3.3