当前位置: 首页>>代码示例>>C#>>正文


C# EC.FpCurve类代码示例

本文整理汇总了C#中Org.BouncyCastle.Math.EC.FpCurve的典型用法代码示例。如果您正苦于以下问题:C# FpCurve类的具体用法?C# FpCurve怎么用?C# FpCurve使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FpCurve类属于Org.BouncyCastle.Math.EC命名空间,在下文中一共展示了FpCurve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PerformTest

		public override void PerformTest()
		{
			IAsymmetricCipherKeyPairGenerator g = GeneratorUtilities.GetKeyPairGenerator("ECIES");

			ECCurve curve = new FpCurve(
				new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"), // q
				new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16), // a
				new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16)); // b

			ECDomainParameters ecSpec = new ECDomainParameters(
				curve,
				curve.DecodePoint(Hex.Decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G
				new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n

			g.Init(
				new ECKeyGenerationParameters(
					ecSpec,
					new SecureRandom()));

			IBufferedCipher c1 = CipherUtilities.GetCipher("ECIES");
			IBufferedCipher c2 = CipherUtilities.GetCipher("ECIES");

			doTest(g, c1, c2);

			g = GeneratorUtilities.GetKeyPairGenerator("ECIES");

			g.Init(new KeyGenerationParameters(new SecureRandom(), 192));

			doTest(g, c1, c2);

			g = GeneratorUtilities.GetKeyPairGenerator("ECIES");

			g.Init(new KeyGenerationParameters(new SecureRandom(), 239));

			doTest(g, c1, c2);

			g = GeneratorUtilities.GetKeyPairGenerator("ECIES");

			g.Init(new KeyGenerationParameters(new SecureRandom(), 256));

			doTest(g, c1, c2);

			doDefTest(g, c1, c2);

			c1 = CipherUtilities.GetCipher("IES");
			c2 = CipherUtilities.GetCipher("IES");

			g = GeneratorUtilities.GetKeyPairGenerator("DH");

//			DHParameterSpec dhParams = new DHParameterSpec(p512, g512);
//			g.initialize(dhParams);
			g.Init(
				new DHKeyGenerationParameters(
					new SecureRandom(),
					new DHParameters(p512, g512)));

			doTest(g, c1, c2);

			doDefTest(g, c1, c2);
		}
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:60,代码来源:IESTest.cs

示例2: TestDecode

        public void TestDecode()
        {
            FpCurve curve = new FpCurve(
                new BigInteger("6277101735386680763835789423207666416083908700390324961279"), // q
                new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a
                new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16)); // b

            ECPoint p = curve.DecodePoint(Hex.Decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012"));

            if (!p.X.ToBigInteger().Equals(new BigInteger("188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", 16)))
            {
                Fail("x uncompressed incorrectly");
            }

            if (!p.Y.ToBigInteger().Equals(new BigInteger("7192b95ffc8da78631011ed6b24cdd573f977a11e794811", 16)))
            {
                Fail("y uncompressed incorrectly");
            }

            byte[] encoding = p.GetEncoded();

            if (!AreEqual(encoding, Hex.Decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")))
            {
                Fail("point compressed incorrectly");
            }
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:26,代码来源:ECTest.cs

示例3: DecodeTest

        public void DecodeTest()
        {
//			EllipticCurve curve = new EllipticCurve(
//				new ECFieldFp(new BigInteger("6277101735386680763835789423207666416083908700390324961279")), // q
//				new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a
//				new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16)); // b
            ECCurve curve = new FpCurve(
                new BigInteger("6277101735386680763835789423207666416083908700390324961279"), // q
                new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a
                new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16)); // b

//			ECPoint p = ECPointUtil.DecodePoint(curve, Hex.Decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012"));
            ECPoint p = curve.DecodePoint(Hex.Decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012"));

            BigInteger x = p.XCoord.ToBigInteger(); //p.getAffineX();

            if (!x.Equals(new BigInteger("188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", 16)))
            {
                Fail("x uncompressed incorrectly");
            }

            BigInteger y = p.YCoord.ToBigInteger(); //p.getAffineX();
            if (!y.Equals(new BigInteger("7192b95ffc8da78631011ed6b24cdd573f977a11e794811", 16)))
            {
                Fail("y uncompressed incorrectly");
            }
        }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:27,代码来源:ECDSA5Test.cs

示例4: TestECNR192bitPrime

		public void TestECNR192bitPrime()
		{
			BigInteger r  = new BigInteger("2474388605162950674935076940284692598330235697454145648371");
			BigInteger s  = new BigInteger("2997192822503471356158280167065034437828486078932532073836");

			byte[] kData = new BigInteger("dcc5d1f1020906df2782360d36b2de7a17ece37d503784af", 16).ToByteArrayUnsigned();

			SecureRandom k = FixedSecureRandom.From(kData);

			FpCurve curve = new FpCurve(
				new BigInteger("6277101735386680763835789423207666416083908700390324961279"), // q (or p)
				new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC", 16),   // a
				new BigInteger("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1", 16));  // b

			ECDomainParameters spec = new ECDomainParameters(
				curve,
				curve.DecodePoint(Hex.Decode("03188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012")), // G
				new BigInteger("6277101735386680763835789423176059013767194773182842284081")); // n


			ECPrivateKeyParameters priKey = new ECPrivateKeyParameters(
				new BigInteger("651056770906015076056810763456358567190100156695615665659"), // d
				spec);

			ECPublicKeyParameters pubKey = new ECPublicKeyParameters(
				curve.DecodePoint(Hex.Decode("0262B12D60690CDCF330BABAB6E69763B471F994DD702D16A5")), // Q
				spec);

			ISigner sgr = SignerUtilities.GetSigner("SHA1withECNR");
			byte[] message = new byte[] { (byte)'a', (byte)'b', (byte)'c' };

			checkSignature(192, priKey, pubKey, sgr, k, message, r, s);
		}
开发者ID:randombit,项目名称:hacrypto,代码行数:33,代码来源:ECNRTest.cs

示例5: KeyAgreement

        public KeyAgreement()
        {
            _curve = new FpCurve(
                new BigInteger("BDB6F4FE3E8B1D9E0DA8C0D46F4C318CEFE4AFE3B6B8551F", 16), // q
                new BigInteger("BB8E5E8FBC115E139FE6A814FE48AAA6F0ADA1AA5DF91985", 16), // a
                new BigInteger("1854BEBDC31B21B7AEFC80AB0ECD10D5B1B3308E6DBF11C1", 16)  // b
                );

            _ecSpec = new ECDomainParameters(
                _curve,
                new FpPoint(_curve,
                        new FpFieldElement(
                            _curve.Q,
                            new BigInteger("4AD5F7048DE709AD51236DE65E4D4B482C836DC6E4106640", 16)
                        ),
                        new FpFieldElement(
                            _curve.Q,
                            new BigInteger("02BB3A02D4AAADACAE24817A4CA3A1B014B5270432DB27D2", 16))
                        ), // G
                        new BigInteger("BDB6F4FE3E8B1D9E0DA8C0D40FC962195DFAE76F56564677", 16), // n
                        BigInteger.One// h
                );
            _keyGen = GeneratorUtilities.GetKeyPairGenerator("ECDH");
            _keyGen.Init(new ECKeyGenerationParameters(_ecSpec, new SecureRandom()));
        }
开发者ID:daluobohao,项目名称:RFIDReader_vfinal,代码行数:25,代码来源:KeyAgreement.cs

示例6: TestECNR239bitPrime

		public void TestECNR239bitPrime()
		{
			BigInteger r = new BigInteger("308636143175167811492623515537541734843573549327605293463169625072911693");
			BigInteger s = new BigInteger("852401710738814635664888632022555967400445256405412579597015412971797143");

			byte[] kData = new BigInteger("700000017569056646655505781757157107570501575775705779575555657156756655").ToByteArrayUnsigned();

			SecureRandom k = FixedSecureRandom.From(kData);

			ECCurve curve = new FpCurve(
				new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"), // q
				new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16), // a
				new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16)); // b

			ECDomainParameters spec = new ECDomainParameters(
				curve,
				curve.DecodePoint(Hex.Decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G
				new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n

			ECPrivateKeyParameters priKey = new ECPrivateKeyParameters(
				new BigInteger("876300101507107567501066130761671078357010671067781776716671676178726717"), // d
				spec);

			ECPublicKeyParameters pubKey = new ECPublicKeyParameters(
				curve.DecodePoint(Hex.Decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q
				spec);

			ISigner sgr = SignerUtilities.GetSigner("SHA1withECNR");
			byte[] message = new byte[] { (byte)'a', (byte)'b', (byte)'c' };

			checkSignature(239, priKey, pubKey, sgr, k, message, r, s);
		}
开发者ID:randombit,项目名称:hacrypto,代码行数:32,代码来源:ECNRTest.cs

示例7: TestECDsa192bitPrime

		public void TestECDsa192bitPrime()
		{
			BigInteger r = new BigInteger("3342403536405981729393488334694600415596881826869351677613");
			BigInteger s = new BigInteger("5735822328888155254683894997897571951568553642892029982342");

			byte[] kData = BigIntegers.AsUnsignedByteArray(new BigInteger("6140507067065001063065065565667405560006161556565665656654"));

			SecureRandom k = FixedSecureRandom.From(kData);

			FpCurve curve = new FpCurve(
				new BigInteger("6277101735386680763835789423207666416083908700390324961279"), // q
				new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a
				new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16)); // b

			ECDomainParameters parameters = new ECDomainParameters(
				curve,
				curve.DecodePoint(Hex.Decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G
				new BigInteger("6277101735386680763835789423176059013767194773182842284081")); // n

			ECPrivateKeyParameters priKey = new ECPrivateKeyParameters(
				"ECDSA",
				new BigInteger("651056770906015076056810763456358567190100156695615665659"), // d
				parameters);

			ParametersWithRandom param = new ParametersWithRandom(priKey, k);

			ECDsaSigner ecdsa = new ECDsaSigner();

			ecdsa.Init(true, param);

			byte[] message = new BigInteger("968236873715988614170569073515315707566766479517").ToByteArray();
			BigInteger[] sig = ecdsa.GenerateSignature(message);

			if (!r.Equals(sig[0]))
			{
				Fail("r component wrong." + SimpleTest.NewLine
					+ " expecting: " + r + SimpleTest.NewLine
					+ " got      : " + sig[0]);
			}

			if (!s.Equals(sig[1]))
			{
				Fail("s component wrong." + SimpleTest.NewLine
					+ " expecting: " + s + SimpleTest.NewLine
					+ " got      : " + sig[1]);
			}

			// Verify the signature
			ECPublicKeyParameters pubKey = new ECPublicKeyParameters(
				"ECDSA",
				curve.DecodePoint(Hex.Decode("0262b12d60690cdcf330babab6e69763b471f994dd702d16a5")), // Q
				parameters);

			ecdsa.Init(false, pubKey);
			if (!ecdsa.VerifySignature(message, sig[0], sig[1]))
			{
				Fail("verification fails");
			}
		}
开发者ID:randombit,项目名称:hacrypto,代码行数:59,代码来源:ECTest.cs

示例8: Encrypt

 public Encrypt(string id, FpPoint tocka, FpPoint Ppublic, BigInteger prost, FpCurve curve, BigInteger stp)
 {
     ID = id;
     P = tocka;
     Ppub = Ppublic;
     prim = prost;
     E = curve;
     k = stp;
 }
开发者ID:excrucio,项目名称:ibe,代码行数:9,代码来源:Encrypt.cs

示例9: CreateParameters

			protected override X9ECParameters CreateParameters()
			{
				ECCurve curve = new FpCurve(
					new BigInteger("C302F41D932A36CDA7A3463093D18DB78FCE476DE1A86297", 16), // q
					new BigInteger("6A91174076B1E0E19C39C031FE8685C1CAE040E5C69A28EF", 16), // a
					new BigInteger("469A28EF7C28CCA3DC721D044F4496BCCA7EF4146FBF25C9", 16)); // b

				return new X9ECParameters(
					curve,
					curve.DecodePoint(Hex.Decode("04C0A0647EAAB6A48753B033C56CB0F0900A2F5C4853375FD614B690866ABD5BB88B5F4828C1490002E6773FA2FA299B8F")), // G
					new BigInteger("C302F41D932A36CDA7A3462F9E9E916B5BE8F1029AC4ACC1", 16), //n
					new BigInteger("01", 16)); // h
			}
开发者ID:kungfubozo,项目名称:Bouncy-Castle-WP8,代码行数:13,代码来源:TeleTrusTNamedCurves.cs

示例10: CreateParameters

			protected override X9ECParameters CreateParameters()
			{
				ECCurve cFp192v3 = new FpCurve(
					new BigInteger("6277101735386680763835789423207666416083908700390324961279"),
					new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16),
					new BigInteger("22123dc2395a05caa7423daeccc94760a7d462256bd56916", 16));

				return new X9ECParameters(
					cFp192v3,
					cFp192v3.DecodePoint(
						Hex.Decode("027d29778100c65a1da1783716588dce2b8b4aee8e228f1896")),
					new BigInteger("ffffffffffffffffffffffff7a62d031c83f4294f640ec13", 16),
					BigInteger.One,
					Hex.Decode("c469684435deb378c4b65ca9591e2a5763059a2e"));
			}
开发者ID:ktw,项目名称:OutlookPrivacyPlugin,代码行数:15,代码来源:X962NamedCurves.cs

示例11: ecNR239bitPrime

        private void ecNR239bitPrime()
        {
            BigInteger n = new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307");

            FpCurve curve = new FpCurve(
                new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"), // q
                new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16), // a
                new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16), // b
                n, BigInteger.One);

            ECDomainParameters parameters = new ECDomainParameters(
                curve,
                curve.DecodePoint(Hex.Decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G
                n);

            ECPrivateKeyParameters priKey = new ECPrivateKeyParameters(
                new BigInteger("876300101507107567501066130761671078357010671067781776716671676178726717"), // d
                parameters);

            ECNRSigner ecnr = new ECNRSigner();
            ParametersWithRandom param = new ParametersWithRandom(priKey, k);

            ecnr.Init(true, param);

            byte[] message = new BigInteger("968236873715988614170569073515315707566766479517").ToByteArray();
            BigInteger[] sig = ecnr.GenerateSignature(message);

            if (!r.Equals(sig[0]))
            {
                Fail("r component wrong.", r, sig[0]);
            }

            if (!s.Equals(sig[1]))
            {
                Fail("s component wrong.", s, sig[1]);
            }

            // Verify the signature
            ECPublicKeyParameters pubKey = new ECPublicKeyParameters(
                curve.DecodePoint(Hex.Decode("025b6dc53bc61a2548ffb0f671472de6c9521a9d2d2534e65abfcbd5fe0c70")), // Q
                parameters);

            ecnr.Init(false, pubKey);
            if (!ecnr.VerifySignature(message, sig[0], sig[1]))
            {
                Fail("signature fails");
            }
        }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:48,代码来源:ECNRTest.cs

示例12: CreateParameters

			protected override X9ECParameters CreateParameters()
			{
				// p = (2^128 - 3) / 76439
				BigInteger p = FromHex("DB7C2ABF62E35E668076BEAD208B");
				BigInteger a = FromHex("6127C24C05F38A0AAAF65C0EF02C");
				BigInteger b = FromHex("51DEF1815DB5ED74FCC34C85D709");
				byte[] S = Hex.Decode("002757A1114D696E6768756151755316C05E0BD4");
				BigInteger n = FromHex("36DF0AAFD8B8D7597CA10520D04B");
				BigInteger h = BigInteger.ValueOf(4);

				ECCurve curve = new FpCurve(p, a, b);
				//ECPoint G = curve.DecodePoint(Hex.Decode("03"
				//+ "4BA30AB5E892B4E1649DD0928643"));
				ECPoint G = curve.DecodePoint(Hex.Decode("04"
					+ "4BA30AB5E892B4E1649DD0928643"
					+ "ADCD46F5882E3747DEF36E956E97"));

				return new X9ECParameters(curve, G, n, h, S);
			}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:19,代码来源:SECNamedCurves.cs

示例13: ecGOST3410_AParam

        /**
         * Test Sign and Verify with A parameters
         * see: http://www.ietf.org/internet-drafts/draft-popov-cryptopro-cpalgs-01.txt
         * gostR3410-2001-CryptoPro-A-ParamSet  P.47
         */
        public void ecGOST3410_AParam()
        {
            SecureRandom    random = new SecureRandom();

            BigInteger mod_p = new BigInteger("115792089237316195423570985008687907853269984665640564039457584007913129639319"); //p

            FpCurve curve = new FpCurve(
                mod_p, // p
                new BigInteger("115792089237316195423570985008687907853269984665640564039457584007913129639316"), // a
                new BigInteger("166")); // b

            ECDomainParameters parameters = new ECDomainParameters(
                curve,
                new FpPoint(curve,
                new FpFieldElement(mod_p, new BigInteger("1")), // x
                new FpFieldElement(mod_p, new BigInteger("64033881142927202683649881450433473985931760268884941288852745803908878638612"))), // y
                new BigInteger("115792089237316195423570985008687907853073762908499243225378155805079068850323")); // q

            ECKeyPairGenerator pGen = new ECKeyPairGenerator("ECGOST3410");
            ECKeyGenerationParameters genParam = new ECKeyGenerationParameters(
                parameters,
                random);

            pGen.Init(genParam);

            AsymmetricCipherKeyPair  pair = pGen.GenerateKeyPair();

            ParametersWithRandom param = new ParametersWithRandom(pair.Private, random);

            ECGost3410Signer ecgost3410 = new ECGost3410Signer();

            ecgost3410.Init(true, param);

            BigInteger[] sig = ecgost3410.GenerateSignature(hashmessage);

            ecgost3410.Init(false, pair.Public);

            if (!ecgost3410.VerifySignature(hashmessage, sig[0], sig[1]))
            {
                Fail("signature fails");
            }
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:47,代码来源:ECGOST3410Test.cs

示例14: TestEC

		public void TestEC()
		{
			BigInteger ECParraGX = new BigInteger(Base64.Decode("D/qWPNyogWzMM7hkK+35BcPTWFc9Pyf7vTs8uaqv"));
			BigInteger ECParraGY = new BigInteger(Base64.Decode("AhQXGxb1olGRv6s1LPRfuatMF+cx3ZTGgzSE/Q5R"));
			BigInteger ECParraH = new BigInteger(Base64.Decode("AQ=="));
			BigInteger ECParraN = new BigInteger(Base64.Decode("f///////////////f///nl6an12QcfvRUiaIkJ0L"));
			BigInteger ECPubQX = new BigInteger(Base64.Decode("HWWi17Yb+Bm3PYr/DMjLOYNFhyOwX1QY7ZvqqM+l"));
			BigInteger ECPubQY = new BigInteger(Base64.Decode("JrlJfxu3WGhqwtL/55BOs/wsUeiDFsvXcGhB8DGx"));
			BigInteger ECPrivD = new BigInteger(Base64.Decode("GYQmd/NF1B+He1iMkWt3by2Az6Eu07t0ynJ4YCAo"));

			FpCurve curve = new FpCurve(
				new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"), // q
				new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16), // a
				new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16)); // b

			ECDomainParameters ecDomain =
				new ECDomainParameters(
					curve,
					new FpPoint(curve,
						curve.FromBigInteger(ECParraGX),
						curve.FromBigInteger(ECParraGY)),
				ECParraN);

			ECPublicKeyParameters ecPub = new ECPublicKeyParameters(
				new FpPoint(
					curve,
					curve.FromBigInteger(ECPubQX),
					curve.FromBigInteger(ECPubQY)),
				ecDomain);

			ECPrivateKeyParameters ecPriv = new ECPrivateKeyParameters(ECPrivD, ecDomain);

			SubjectPublicKeyInfo subinfo = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(ecPub);
			PrivateKeyInfo privInfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo(ecPriv);

			ECPublicKeyParameters tecPub = (ECPublicKeyParameters)PublicKeyFactory.CreateKey(subinfo);
			ECPrivateKeyParameters tecPriv = (ECPrivateKeyParameters)PrivateKeyFactory.CreateKey(privInfo);

			Assert.IsTrue(tecPub.Equals(ecPub), "EC: public key to info back to public key");
			Assert.IsTrue(tecPriv.Equals(ecPriv), "EC: private key to info back to private key");
		}
开发者ID:randombit,项目名称:hacrypto,代码行数:41,代码来源:TestEncodings.cs

示例15: PerformTest

        public override void PerformTest()
        {
            StaticTest();

            FpCurve curve = new FpCurve(
                new BigInteger("6277101735386680763835789423207666416083908700390324961279"), // q
                new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16), // a
                new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16)); // b

            ECDomainParameters parameters = new ECDomainParameters(
                curve,
                curve.DecodePoint(Hex.Decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")), // G
                new BigInteger("6277101735386680763835789423176059013767194773182842284081")); // n

            ECKeyPairGenerator eGen = new ECKeyPairGenerator();
            KeyGenerationParameters gParam = new ECKeyGenerationParameters(parameters, new SecureRandom());

            eGen.Init(gParam);

            AsymmetricCipherKeyPair p1 = eGen.GenerateKeyPair();
            AsymmetricCipherKeyPair p2 = eGen.GenerateKeyPair();

            DoTest(p1, p2);
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:24,代码来源:ECIESTest.cs


注:本文中的Org.BouncyCastle.Math.EC.FpCurve类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。