| 141 | } |
| 142 | |
| 143 | unsigned int ElGamalCryptoPrivateKey::Decrypt(const byte *cipherText, byte *plainText) |
| 144 | { |
| 145 | Integer a(cipherText, modulusLen); |
| 146 | Integer b(cipherText+modulusLen, modulusLen); |
| 147 | Integer m; |
| 148 | |
| 149 | RawDecrypt(a, b, m); |
| 150 | m.Encode(plainText, 1); |
| 151 | unsigned int plainTextLength = plainText[0]; |
| 152 | if (plainTextLength > MaxPlainTextLength()) |
| 153 | return 0; |
| 154 | m >>= 8; |
| 155 | m.Encode(plainText, plainTextLength); |
| 156 | return plainTextLength; |
| 157 | } |
| 158 | |
| 159 | void ElGamalCryptoPrivateKey::RawDecrypt(const Integer &a, const Integer &b, Integer &m) const |
| 160 | { |