MCPcopy Create free account
hub / github.com/LUX-Core/lux / Decrypt

Method Decrypt

src/cryptopp/pubkey.cpp:140–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140DecodingResult TF_DecryptorBase::Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, size_t ciphertextLength, byte *plaintext, const NameValuePairs &parameters) const
141{
142 if (ciphertextLength != FixedCiphertextLength())
143 throw InvalidArgument(AlgorithmName() + ": ciphertext length of " + IntToString(ciphertextLength) + " doesn't match the required length of " + IntToString(FixedCiphertextLength()) + " for this key");
144
145 SecByteBlock paddedBlock(PaddedBlockByteLength());
146 Integer x = GetTrapdoorFunctionInterface().CalculateInverse(rng, Integer(ciphertext, ciphertextLength));
147 if (x.ByteCount() > paddedBlock.size())
148 x = Integer::Zero(); // don't return false here to prevent timing attack
149 x.Encode(paddedBlock, paddedBlock.size());
150 return GetMessageEncodingInterface().Unpad(paddedBlock, PaddedBlockBitLength(), plaintext, parameters);
151}
152
153void TF_EncryptorBase::Encrypt(RandomNumberGenerator &rng, const byte *plaintext, size_t plaintextLength, byte *ciphertext, const NameValuePairs &parameters) const
154{

Callers 4

decryptMethod · 0.45
CryptoSystemValidateFunction · 0.45
Put2Method · 0.45
BenchMarkDecryptionFunction · 0.45

Calls 9

FixedCiphertextLengthFunction · 0.85
IntToStringFunction · 0.85
ByteCountMethod · 0.80
AlgorithmNameFunction · 0.70
IntegerClass · 0.70
CalculateInverseMethod · 0.45
sizeMethod · 0.45
EncodeMethod · 0.45
UnpadMethod · 0.45

Tested by

no test coverage detected