| 167 | } |
| 168 | |
| 169 | void DbCrypt::decrypt(CheckStatusWrapper* status, unsigned int length, const void* from, void* to) |
| 170 | { |
| 171 | status->init(); |
| 172 | |
| 173 | if (!key) |
| 174 | { |
| 175 | noKeyError(status); |
| 176 | return; |
| 177 | } |
| 178 | |
| 179 | const ISC_UCHAR* f = static_cast<const ISC_UCHAR*>(from); |
| 180 | ISC_UCHAR* t = static_cast<ISC_UCHAR*>(to); |
| 181 | |
| 182 | while (length--) |
| 183 | { |
| 184 | *t++ = (*f++) ^ key; |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | void DbCrypt::setKey(CheckStatusWrapper* status, unsigned int length, IKeyHolderPlugin** sources, |
| 189 | const char* keyName) |