C#的BouncyCastle.Crypto,RSA算法調用的源碼,正在研究這個,分享給大家。
官網:http://www.bouncycastle.org/csharp/
BigInteger mod = BigInteger(, BigInteger pubExp = BigInteger(, BigInteger privExp = BigInteger(, BigInteger p = BigInteger(, BigInteger q = BigInteger(, BigInteger pExp = BigInteger(, BigInteger qExp = BigInteger(, BigInteger crtCoef = BigInteger(, input = edgeInput = [] oversizedSig = Hex.Decode( [] dudBlock = Hex.Decode( [] truncatedDataBlock = Hex.Decode( [] incorrectPadding = Hex.Decode( [] missingDataBlock = Hex.Decode( { IAsymmetricBlockCipher eng = eng.Init( [] data = data = eng.ProcessBlock(oversizedSig, Fail( + eng = eng.Init( data = eng.ProcessBlock(data, Fail( (!e.Message.Equals( Fail( + Pkcs1Encoding.StrictLengthEnabled = eng = Pkcs1Encoding( eng.Init( data = eng.ProcessBlock(data, Fail( + Pkcs1Encoding.StrictLengthEnabled = checkForPkcs1Exception(pubParameters, privParameters, truncatedDataBlock, checkForPkcs1Exception(pubParameters, privParameters, dudBlock, checkForPkcs1Exception(pubParameters, privParameters, incorrectPadding, checkForPkcs1Exception(pubParameters, privParameters, missingDataBlock, checkForPkcs1Exception(RsaKeyParameters pubParameters, RsaKeyParameters privParameters, [] inputData, IAsymmetricBlockCipher eng = eng.Init( [] data = data = eng.ProcessBlock(inputData, Fail( + eng = eng.Init( data = eng.ProcessBlock(data, Fail( (! Fail( + IAsymmetricBlockCipher eng = OaepEncoding( [] data = eng.Init( data = eng.ProcessBlock(data, Fail( + eng.Init( data = eng.ProcessBlock(data, Fail( + (! Fail( doTestBadSig() ISigner sig = SignerUtilities.GetSigner( RsaKeyPairGenerator fact = RsaKeyGenerationParameters factParams = BigInteger.ValueOf(), SecureRandom(), , AsymmetricCipherKeyPair keyPair = AsymmetricKeyParameter priv = AsymmetricKeyParameter pub = IDigest sha1 = DigestUtilities.GetDigest( IAsymmetricBlockCipher signer = Pkcs1Encoding( signer.Init( [] block = sha1.Update( [] sigHeader = Hex.Decode( Array.Copy(sigHeader, , block, Array.Copy(sigHeader, sigHeader.Length + [] sigBytes = signer.ProcessBlock(block, ISigner verifier = SignerUtilities.GetSigner( verifier.Init( verifier.Update( Fail( IAsymmetricBlockCipher eng = Pkcs1Encoding( eng.Init( (eng.GetOutputBlockSize() != Fail( [] zero = [ [] data = data = eng.ProcessBlock(zero, Fail( + eng.Init( data = eng.ProcessBlock(data, Fail( + (! Fail( RsaKeyParameters pubParameters = RsaKeyParameters( RsaKeyParameters privParameters = [] data = IAsymmetricBlockCipher eng = eng.Init( data = eng.ProcessBlock(data, Fail( + eng.Init( data = eng.ProcessBlock(data, Fail( + (! Fail( data = eng.Init( data = eng.ProcessBlock(data, Fail( + eng.Init( data = eng.ProcessBlock(data, Fail( + (! Fail( eng = eng.Init( (eng.GetOutputBlockSize() != Fail( data = eng.ProcessBlock(data, Fail( + eng.Init( data = eng.ProcessBlock(data, Fail( + (! Fail( eng = eng.Init( data = eng.ProcessBlock(data, Fail( + eng.Init( data = eng.ProcessBlock(data, Fail( + (! Fail( RsaKeyPairGenerator pGen = RsaKeyGenerationParameters genParam = BigInteger.ValueOf(), SecureRandom(), , AsymmetricCipherKeyPair pair = eng = (((RsaKeyParameters)pair.Public).Modulus.BitLength < Fail( eng.Init( data = eng.ProcessBlock(data, Fail( + eng.Init( data = eng.ProcessBlock(data, Fail( + (! Fail( genParam = RsaKeyGenerationParameters(BigInteger.ValueOf(), SecureRandom(), , pair = eng.Init( (((RsaKeyParameters)pair.Public).Modulus.BitLength < Fail( data = eng.ProcessBlock(data, Fail( + eng.Init( data = eng.ProcessBlock(data, Fail( + (! Fail( genParam = BigInteger.ValueOf(), SecureRandom(), , ( i = ; i < ; ++ pair = RsaPrivateCrtKeyParameters privKey = BigInteger pqDiff = (pqDiff.BitLength < Fail( RsaEngine().ProcessBlock( [] { }, , Fail( ITest test = ITestResult result = }