Decrypter::Decrypter(const std::string& raw_private_key) { Converter conv; private_key_t private_key = conv.read_private_key(raw_private_key); m_modulus = private_key.modulus; m_exponent = private_key.exponent; m_plain_length = LongIntConverter::byte_size(m_modulus) - 1; m_key_part_length = LongIntConverter::byte_size(m_modulus); m_cipher_part_length = LongIntConverter::byte_size(m_modulus); m_cipher_length = m_key_part_length + m_cipher_part_length; }
Signer::Signer(const std::string& raw_private_key) { Converter conv; private_key_t private_key = conv.read_private_key(raw_private_key); m_modulus = private_key.modulus; m_generator = private_key.generator; m_phi_modulus = m_modulus - ONE; m_exponent = private_key.exponent; m_k_distribution = UniformLongIntDistribution(ONE, m_phi_modulus - ONE); m_r_length = m_modulus.size() * sizeof(number_t::part_type); m_s_length = m_modulus.size() * sizeof(number_t::part_type); m_signature_length = m_r_length + m_s_length; }