| 10 | #include <QDebug> |
| 11 | |
| 12 | BioByteArray::BioByteArray(const BIGNUM *bn, int bits) |
| 13 | { |
| 14 | int len = (bits+7) >> 3; |
| 15 | qDebug() << bits << len; |
| 16 | if (!bn) |
| 17 | return; |
| 18 | store.resize(BN_num_bytes(bn)); |
| 19 | BN_bn2bin(bn, (unsigned char *)store.data()); |
| 20 | openssl_error(); |
| 21 | if (store.size() > 0 && (unsigned char)store[0] >= 0x80) |
| 22 | store.prepend('\0'); |
| 23 | if (len > 0 && store.size() < len) |
| 24 | store.prepend(len - store.size(), 0); |
| 25 | } |
| 26 | |
| 27 | void BioByteArray::set(const QByteArray &qba) |
| 28 | { |