示例#1
0
        public SignaureKey GenerateSignature(int keyByteLength)
        {
            int componentLength = keyByteLength * 8 / 2;

            OmgNum p = m_primeSource.GeneratePrime(componentLength);
            OmgNum q = m_primeSource.GeneratePrime(componentLength);

            OmgNum n     = OmgOp.Multiply(p, q);
            OmgNum carmN = _Carmichael(p.Dec(), q.Dec());
            OmgNum e     = _SelectRandomExponent(carmN, out OmgNum d);

            p.Release();
            p.Release();

            return(new SignaureKey {
                cert = new SignCertificate {
                    N = n.Copy(), D = d
                },
                secret = new SignSecret()
                {
                    N = n, E = e
                }
            });
        }