aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-12-12 17:41:01 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2018-02-23 15:42:37 +0100
commit66a67b7b69b9cb43a810449761c78883e9e11bd6 (patch)
tree2436627cbb2aef9d187d554d6e5bda2388df247d
parent025774fc3759683a8ec0f6b1598b1e34b550e6d5 (diff)
downloadlibnitrokey-66a67b7b69b9cb43a810449761c78883e9e11bd6.tar.gz
libnitrokey-66a67b7b69b9cb43a810449761c78883e9e11bd6.tar.bz2
C API for Encrypted volume ro/rw switch
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--NK_C_API.cc14
-rw-r--r--NK_C_API.h23
2 files changed, 37 insertions, 0 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index c886b6a..9b53b49 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -509,6 +509,20 @@ extern "C" {
});
}
+ NK_C_API int NK_set_encrypted_read_only(const char* admin_pin) {
+ auto m = NitrokeyManager::instance();
+ return get_without_result([&]() {
+ m->set_encrypted_volume_read_only(admin_pin);
+ });
+ }
+
+ NK_C_API int NK_set_encrypted_read_write(const char* admin_pin) {
+ auto m = NitrokeyManager::instance();
+ return get_without_result([&]() {
+ m->set_encrypted_volume_read_write(admin_pin);
+ });
+ }
+
NK_C_API int NK_export_firmware(const char* admin_pin) {
auto m = NitrokeyManager::instance();
return get_without_result([&]() {
diff --git a/NK_C_API.h b/NK_C_API.h
index 0131caa..bd7130f 100644
--- a/NK_C_API.h
+++ b/NK_C_API.h
@@ -445,6 +445,29 @@ extern "C" {
NK_C_API int NK_set_unencrypted_read_write(const char* user_pin);
/**
+ * Make encrypted volume read-only.
+ * Device hides encrypted volume for a second therefore make sure
+ * buffers are flushed before running.
+ * Storage only
+ * @param admin_pin 20 characters
+ * @return command processing error code
+ */
+ NK_C_API int NK_set_encrypted_read_only(const char* admin_pin);
+
+ /**
+ * Make encrypted volume read-write.
+ * Device hides encrypted volume for a second therefore make sure
+ * buffers are flushed before running.
+ * Storage only
+ * @param admin_pin 20 characters
+ * @return command processing error code
+ */
+ NK_C_API int NK_set_encrypted_read_write(const char* admin_pin);
+
+
+
+
+ /**
* Exports device's firmware to unencrypted volume.
* Storage only
* @param admin_pin 20 characters