示例#1
0
        public static BigInt EncryptRSA(Key PrivateK, BigInt PPlain)
        {
            PublicKey PK      = PrivateK as PublicKey;
            BigInt    PCipher = PPlain.PowModPrim(PK.E, PK.N);

            return(PCipher);
        }
示例#2
0
        public static BigInt DecryptRSA(Key PrivateK, BigInt PCipher)
        {
            PrivateKey PK     = PrivateK as PrivateKey;
            BigInt     PPlain = PCipher.PowModPrim(PK.D, PK.N);

            return(PPlain);
        }
示例#3
0
        public BigInt GetNextSeed(int i = 0)
        {
            BigInt B2 = new BigInt(this.S.Size, 2);

            if (i <= 0)
            {
                BigInt Seed = this.S.PowModPrim(B2, this.N);
                return(Seed);
            }
            else
            {
                BigInt Index = new BigInt(this.S.Size, i);
                BigInt ScmPQ = BigInt.Scm(P - 1, Q - 1);
                BigInt Exp   = B2.PowModPrim(Index, ScmPQ);
                BigInt Seed  = this.S.PowModPrim(Exp, this.N);

                return(Seed);
            }
        }