askarKeyConvert function
Implementation
AskarResult<LocalKeyHandle> askarKeyConvert(LocalKeyHandle handle, KeyAlgorithm alg) {
Pointer<NativeLocalKeyHandle> localKeyHandlePtr = calloc<NativeLocalKeyHandle>();
Pointer<Utf8> algPointer = nullptr;
try {
algPointer = alg.value.toNativeUtf8();
final result = nativeAskarKeyConvert(handle.toInt(), algPointer, localKeyHandlePtr);
final errorCode = ErrorCode.fromInt(result);
final localKeyHandle = LocalKeyHandle.fromPointer(errorCode, localKeyHandlePtr);
return AskarResult<LocalKeyHandle>(errorCode, localKeyHandle);
} finally {
freePointer(localKeyHandlePtr);
freePointer(algPointer);
}
}