src/main/java/cn/jiguang/common/utils/sm2/BCECUtil.java
public static BCECPrivateKey convertSEC1ToBCECPrivateKey(byte[] sec1Key)
        throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException, IOException {
        PKCS8EncodedKeySpec peks = new PKCS8EncodedKeySpec(convertECPrivateKeySEC1ToPKCS8(sec1Key));
        KeyFactory kf = KeyFactory.getInstance(ALGO_NAME_EC, BouncyCastleProvider.PROVIDER_NAME);
        return (BCECPrivateKey) kf.generatePrivate(peks);
    }
public static BCECPrivateKey convertSEC1ToBCECPrivateKey(byte[] sec1Key)
        throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException, IOException {
        PKCS8EncodedKeySpec peks = new PKCS8EncodedKeySpec(convertECPrivateKeySEC1ToPKCS8(sec1Key));
        KeyFactory kf = KeyFactory.getInstance(ALGO_NAME_EC, BouncyCastleProvider.PROVIDER_NAME);
        return (BCECPrivateKey) kf.generatePrivate(peks);
    }
public static BCECPrivateKey convertSEC1ToBCECPrivateKey ( byte [ ] sec1Key ) throws NoSuchAlgorithmException , NoSuchProviderException , InvalidKeySpecException , IOException { PKCS8EncodedKeySpec peks = new PKCS8EncodedKeySpec ( convertECPrivateKeySEC1ToPKCS8 ( sec1Key ) ) ; KeyFactory kf = KeyFactory . getInstance ( ALGO_NAME_EC , BouncyCastleProvider . PROVIDER_NAME ) ; return ( BCECPrivateKey ) kf . generatePrivate ( peks ) ; }
将SEC1标准的私钥字节流转为BCECPrivateKey对象

@param sec1Key
@return
@throws NoSuchAlgorithmException
@throws NoSuchProviderException
@throws InvalidKeySpecException
@throws IOException
将SEC1标准的私钥字节流转为BCECPrivateKey对象