| 407 | } |
| 408 | |
| 409 | MMKV_EXPORT void *cryptKey(void *handle, uint64_t *lengthPtr) { |
| 410 | MMKV *kv = static_cast<MMKV *>(handle); |
| 411 | if (kv && lengthPtr) { |
| 412 | auto cryptKey = kv->cryptKey(); |
| 413 | if (cryptKey.length() > 0) { |
| 414 | auto ptr = malloc(cryptKey.length()); |
| 415 | if (ptr) { |
| 416 | memcpy(ptr, cryptKey.data(), cryptKey.length()); |
| 417 | *lengthPtr = cryptKey.length(); |
| 418 | return ptr; |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | return nullptr; |
| 423 | } |
| 424 | |
| 425 | MMKV_EXPORT void checkReSetCryptKey(void *handle, char *oKey, uint64_t length, bool aes256) { |
| 426 | MMKV *kv = static_cast<MMKV *>(handle); |