MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / Decrypt

Method Decrypt

extra/yassl/taocrypt/include/rsa.hpp:195–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193// Private Decrypt
194template<class Pad>
195word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
196 RandomNumberGenerator& rng)
197{
198 PK_Lengths lengths(key_.GetModulus());
199
200 if (sz != lengths.FixedCiphertextLength())
201 return 0;
202
203 ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
204 Integer x = key_.CalculateInverse(rng, Integer(cipher,
205 lengths.FixedCiphertextLength()).Ref());
206 if (x.ByteCount() > paddedBlock.size())
207 x = Integer::Zero(); // don't return false, prevents timing attack
208 x.Encode(paddedBlock.get_buffer(), paddedBlock.size());
209 return padding_.UnPad(paddedBlock.get_buffer(),
210 lengths.PaddedBlockBitLength(), plain);
211}
212
213
214// Private SSL type (block 1) Encrypt

Callers 3

bench_rsaFunction · 0.80
rsa_testFunction · 0.80
decryptMethod · 0.80

Calls 9

PaddedBlockByteLengthMethod · 0.80
CalculateInverseMethod · 0.80
EncodeMethod · 0.80
UnPadMethod · 0.80
PaddedBlockBitLengthMethod · 0.80
IntegerClass · 0.70
FixedCiphertextLengthMethod · 0.45
sizeMethod · 0.45
get_bufferMethod · 0.45

Tested by 1

rsa_testFunction · 0.64