• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IBigInteger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Generate

        public TimeStampRequest Generate(
			string		digestAlgorithmOid,
			byte[]		digest,
			IBigInteger	nonce)
        {
            if (digestAlgorithmOid == null)
            {
                throw new ArgumentException("No digest algorithm specified");
            }

            DerObjectIdentifier digestAlgOid = new DerObjectIdentifier(digestAlgorithmOid);

            AlgorithmIdentifier algID = new AlgorithmIdentifier(digestAlgOid, DerNull.Instance);
            MessageImprint messageImprint = new MessageImprint(algID, digest);

            X509Extensions  ext = null;

            if (extOrdering.Count != 0)
            {
                ext = new X509Extensions(extOrdering, extensions);
            }

            DerInteger derNonce = nonce == null
                ?	null
                :	new DerInteger(nonce);

            return new TimeStampRequest(
                new TimeStampReq(messageImprint, reqPolicy, derNonce, certReq, ext));
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:29,代码来源:TimeStampRequestGenerator.cs


示例2: DsaPublicBcpgKey

 public DsaPublicBcpgKey(IBigInteger p, IBigInteger q, IBigInteger g, IBigInteger y)
 {
     _p = new MPInteger(p);
     _q = new MPInteger(q);
     _g = new MPInteger(g);
     _y = new MPInteger(y);
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:DsaPublicBcpgKey.cs


示例3: NaccacheSternKeyParameters

 /**
  * @param privateKey
  */
 public NaccacheSternKeyParameters(bool privateKey, IBigInteger g, IBigInteger n, int lowerSigmaBound)
     : base(privateKey)
 {
     this.g = g;
     this.n = n;
     this.lowerSigmaBound = lowerSigmaBound;
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:10,代码来源:NaccacheSternKeyParameters.cs


示例4: ImplShamirsTrick

        private static ECPoint ImplShamirsTrick(ECPoint p, IBigInteger k, ECPoint q, IBigInteger l)
        {
            var m = System.Math.Max(k.BitLength, l.BitLength);
            var z = p.Add(q);
            var r = p.Curve.Infinity;

            for (var i = m - 1; i >= 0; --i)
            {
                r = r.Twice();

                if (k.TestBit(i))
                {
                    r = r.Add(l.TestBit(i) ? z : p);
                }
                else
                {
                    if (l.TestBit(i))
                    {
                        r = r.Add(q);
                    }
                }
            }

            return r;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:25,代码来源:ECAlgorithms.cs


示例5: CreateRandomInRange

        /**
        * Return a random IBigInteger not less than 'min' and not greater than 'max'
        *
        * @param min the least value that may be generated
        * @param max the greatest value that may be generated
        * @param random the source of randomness
        * @return a random IBigInteger value in the range [min,max]
        */
        public static IBigInteger CreateRandomInRange(
            IBigInteger min,
            IBigInteger max,
			// TODO Should have been just Random class
			ISecureRandom	random)
        {
            int cmp = min.CompareTo(max);
            if (cmp >= 0)
            {
                if (cmp > 0)
                    throw new ArgumentException("'min' may not be greater than 'max'");

                return min;
            }

            if (min.BitLength > max.BitLength / 2)
            {
                return CreateRandomInRange(BigInteger.Zero, max.Subtract(min), random).Add(min);
            }

            for (int i = 0; i < MaxIterations; ++i)
            {
                IBigInteger x = new BigInteger(max.BitLength, random);
                if (x.CompareTo(min) >= 0 && x.CompareTo(max) <= 0)
                {
                    return x;
                }
            }

            // fall back to a faster (restricted) method
            return new BigInteger(max.Subtract(min).BitLength - 1, random).Add(min);
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:40,代码来源:BigIntegers.cs


示例6: DHPrivateKeyParameters

 public DHPrivateKeyParameters(
     IBigInteger x,
     DHParameters	parameters)
     : base(true, parameters)
 {
     this.x = x;
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:DHPrivateKeyParameters.cs


示例7: Gost3410Parameters

        public Gost3410Parameters(
			IBigInteger	p,
			IBigInteger	q,
			IBigInteger	a)
            : this(p, q, a, null)
        {
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:GOST3410Parameters.cs


示例8: DHParameters

 public DHParameters(
     IBigInteger p,
     IBigInteger g,
     IBigInteger q)
     : this(p, g, q, 0)
 {
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:DHParameters.cs


示例9: Multiply

        /**
        * D.3.2 pg 101
        * @see org.bouncycastle.math.ec.multiplier.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPoint, java.math.BigInteger)
        */
        public ECPoint Multiply(ECPoint p, IBigInteger k, IPreCompInfo preCompInfo)
        {
            // TODO Probably should try to add this
            // IBigInteger e = k.Mod(n); // n == order of p
            IBigInteger e = k;
            IBigInteger h = e.Multiply(BigInteger.Three);

            ECPoint neg = p.Negate();
            ECPoint R = p;

            for (int i = h.BitLength - 2; i > 0; --i)
            {
                R = R.Twice();

                bool hBit = h.TestBit(i);
                bool eBit = e.TestBit(i);

                if (hBit != eBit)
                {
                    R = R.Add(hBit ? p : neg);
                }
            }

            return R;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:29,代码来源:FpNafMultiplier.cs


示例10: DsaParameters

 public DsaParameters(
     IBigInteger p,
     IBigInteger q,
     IBigInteger g)
     : this(p, q, g, null)
 {
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:DsaParameters.cs


示例11: RsaPrivateCrtKeyParameters

        public RsaPrivateCrtKeyParameters(
            IBigInteger modulus,
            IBigInteger publicExponent,
            IBigInteger privateExponent,
            IBigInteger p,
            IBigInteger q,
            IBigInteger dP,
            IBigInteger dQ,
            IBigInteger qInv)
            : base(true, modulus, privateExponent)
        {
            ValidateValue(publicExponent, "publicExponent", "exponent");
            ValidateValue(p, "p", "P value");
            ValidateValue(q, "q", "Q value");
            ValidateValue(dP, "dP", "DP value");
            ValidateValue(dQ, "dQ", "DQ value");
            ValidateValue(qInv, "qInv", "InverseQ value");

            this.e = publicExponent;
            this.p = p;
            this.q = q;
            this.dP = dP;
            this.dQ = dQ;
            this.qInv = qInv;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:25,代码来源:RsaPrivateCrtKeyParameters.cs


示例12: Init

 /**
  * Initialises the client to begin new authentication attempt
  * @param N The safe prime associated with the client's verifier
  * @param g The group parameter associated with the client's verifier
  * @param digest The digest algorithm associated with the client's verifier
  * @param random For key generation
  */
 public virtual void Init(IBigInteger N, IBigInteger g, IDigest digest, SecureRandom random)
 {
     this.N = N;
     this.g = g;
     this.digest = digest;
     this.random = random;
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:14,代码来源:SRP6Client.cs


示例13: ElGamalParameter

 public ElGamalParameter(
     IBigInteger	p,
     IBigInteger	g)
 {
     this.p = new DerInteger(p);
     this.g = new DerInteger(g);
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:ElGamalParameter.cs


示例14: Generate

 public TimeStampResponse Generate(
     TimeStampRequest request,
     IBigInteger serialNumber,
     DateTime genTime)
 {
     return Generate(request, serialNumber, new DateTimeObject(genTime));
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:TimeStampResponseGenerator.cs


示例15: IssuerAndSerialNumber

 public IssuerAndSerialNumber(
     X509Name	name,
     IBigInteger	serialNumber)
 {
     this.name = name;
     this.serialNumber = new DerInteger(serialNumber);
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:IssuerAndSerialNumber.cs


示例16: ElGamalPublicKeyParameters

        public ElGamalPublicKeyParameters(IBigInteger y, ElGamalParameters parameters)
            : base(false, parameters)
        {
            if (y == null)
                throw new ArgumentNullException("y");

            _y = y;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:8,代码来源:ElGamalPublicKeyParameters.cs


示例17: GenerateClientCredentials

        /**
         * Generates client's credentials given the client's salt, identity and password
         * @param salt The salt used in the client's verifier.
         * @param identity The user's identity (eg. username)
         * @param password The user's password
         * @return Client's public value to send to server
         */
        public virtual IBigInteger GenerateClientCredentials(byte[] salt, byte[] identity, byte[] password)
        {
            this.x = Srp6Utilities.CalculateX(digest, N, salt, identity, password);
            this.privA = SelectPrivateValue();
            this.pubA = g.ModPow(privA, N);

            return pubA;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:15,代码来源:SRP6Client.cs


示例18: CalculateSecret

        /**
         * Generates client's verification message given the server's credentials
         * @param serverB The server's credentials
         * @return Client's verification message for the server
         * @throws CryptoException If server's credentials are invalid
         */
        public virtual IBigInteger CalculateSecret(IBigInteger serverB)
        {
            this.B = Srp6Utilities.ValidatePublicValue(N, serverB);
            this.u = Srp6Utilities.CalculateU(digest, N, pubA, B);
            this.S = CalculateS();

            return S;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:14,代码来源:SRP6Client.cs


示例19: ECPrivateKeyParameters

        public ECPrivateKeyParameters(string algorithm, IBigInteger d, ECDomainParameters parameters)
            : base(algorithm, true, parameters)
        {
            if (d == null)
                throw new ArgumentNullException("d");

            _d = d;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:8,代码来源:ECPrivateKeyParameters.cs


示例20: Create

        /// <summary>
        /// Creates a ECDH public key parameters from the given encoded point.
        /// </summary>
        /// <param name="encodedPoint">The encoded point.</param>
        /// <param name="publicKeyParamSet">The public key param set.</param>
        /// <param name="hashAlgorithm">The hash algorithm.</param>
        /// <param name="symmetricKeyAlgorithm">The symmetric key algorithm.</param>
        /// <returns></returns>
        public static ECDHPublicKeyParameters Create(IBigInteger encodedPoint, DerObjectIdentifier publicKeyParamSet, 
            HashAlgorithmTag hashAlgorithm, SymmetricKeyAlgorithmTag symmetricKeyAlgorithm)
        {
            var curve = ECKeyPairGenerator.FindECCurveByOid(publicKeyParamSet);
            var point = curve.Curve.DecodePoint(encodedPoint.ToByteArrayUnsigned());

            return new ECDHPublicKeyParameters(point, publicKeyParamSet, hashAlgorithm, symmetricKeyAlgorithm);
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:16,代码来源:ECDHPublicKeyParameters.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IBin类代码示例发布时间:2022-05-24
下一篇:
C# IBehavior类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap