/// <summary> /// 通过PKCS#1私钥进行加密,可以指定密文字符串分组间的分隔符,默认为'&' /// </summary> /// <param name="PKCS1_Pri_Key"></param> /// <param name="strCipher"></param> /// <param name="strCoding"></param> /// <param name="chSplit"></param> /// <returns></returns> public static string Decrypt_PKCS1_S(string PKCS1_Pri_Key, string strCipher, string strCoding, char chSplit = '&') { RSA_Cipher rsaCipher = new RSA_Cipher(strCipher, chSplit); BigInteger[] RSA_PriKey = RSA_Read.PKCS1_Pri_Read(PKCS1_Pri_Key); ByteString bsPlain = new ByteString(); foreach (BigInteger biCipher in rsaCipher.bilData) { BigInteger biPlain = Decrypt(biCipher, RSA_PriKey[3], RSA_PriKey[1]); bsPlain += biPlain.ToByteArray(); } return(new string(Encoding.GetEncoding(strCoding).GetChars(bsPlain.GetBytes()))); }
/// <summary> /// 通过PKCS#1格式私钥生成公钥并进行BASE64转换 /// </summary> /// <param name="strPKCS1Pri"></param> /// <returns></returns> public static string PKCS1_Pub_Gen_S(string strPKCS1Pri) { BigInteger[] RSA_Key = RSA_Read.PKCS1_Pri_Read(strPKCS1Pri); return(PKCS1_Pub_Gen_S(RSA_Key[1], RSA_Key[2])); }