public CryptoRSA() { _core = new CryptoCore(); _p = _core.GetRandomPrime(1, MaxPrimeP); _q = _core.GetRandomPrime(1, MaxPrimeQ); _modulus = _core.KaratsubaMultiply(_p, _q); _totient = _modulus - (_p + _q - 1); _key = _core.GetRandomPrime(1, _totient); _d = _core.ModularMultiplicativeInverse(_key, _totient); CryptoData = new CryptoRSAData(_modulus, _key); }
public long Encryption(long message, CryptoRSAData cryptoData) { return(_core.Pows(message, cryptoData.Key, cryptoData.Modulus)); }