summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NitrokeyManager.cc20
-rw-r--r--include/NitrokeyManager.h8
-rw-r--r--include/stick20_commands.h15
3 files changed, 43 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 814c4a6..14e3952 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -789,6 +789,14 @@ using nitrokey::misc::strcpyT;
misc::execute_password_command<stick20::EnableHiddenEncryptedPartition>(device, hidden_volume_password);
}
+ void NitrokeyManager::set_encrypted_volume_read_only(const char* admin_pin) {
+ misc::execute_password_command<stick20::SetEncryptedVolumeReadOnly>(device, admin_pin);
+ }
+
+ void NitrokeyManager::set_encrypted_volume_read_write(const char* admin_pin) {
+ misc::execute_password_command<stick20::SetEncryptedVolumeReadWrite>(device, admin_pin);
+ }
+
//TODO check is encrypted volume unlocked before execution
//if not return library exception
void NitrokeyManager::create_hidden_volume(uint8_t slot_nr, uint8_t start_percent, uint8_t end_percent,
@@ -802,13 +810,25 @@ using nitrokey::misc::strcpyT;
}
void NitrokeyManager::set_unencrypted_read_only(const char* user_pin) {
+ //available until 0.48
misc::execute_password_command<stick20::SendSetReadonlyToUncryptedVolume>(device, user_pin);
}
void NitrokeyManager::set_unencrypted_read_write(const char* user_pin) {
+ //available until 0.48
misc::execute_password_command<stick20::SendSetReadwriteToUncryptedVolume>(device, user_pin);
}
+ void NitrokeyManager::set_unencrypted_read_only_admin_pin(const char* admin_pin) {
+ //available from 0.49
+ misc::execute_password_command<stick20::SetUnencryptedVolumeReadOnlyAdmin>(device, admin_pin);
+ }
+
+ void NitrokeyManager::set_unencrypted_read_write_admin_pin(const char* admin_pin) {
+ //available from 0.49
+ misc::execute_password_command<stick20::SetUnencryptedVolumeReadWriteAdmin>(device, admin_pin);
+ }
+
void NitrokeyManager::export_firmware(const char* admin_pin) {
misc::execute_password_command<stick20::ExportFirmware>(device, admin_pin);
}
diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h
index 9a1686c..8f47860 100644
--- a/include/NitrokeyManager.h
+++ b/include/NitrokeyManager.h
@@ -202,6 +202,14 @@ char * strndup(const char* str, size_t maxlen);
void set_loglevel(Loglevel loglevel);
void set_loglevel(int loglevel);
+
+ void set_encrypted_volume_read_only(const char *admin_pin);
+
+ void set_encrypted_volume_read_write(const char *admin_pin);
+
+ void set_unencrypted_read_write_admin_pin(const char *admin_pin);
+
+ void set_unencrypted_read_only_admin_pin(const char *admin_pin);
};
}
diff --git a/include/stick20_commands.h b/include/stick20_commands.h
index 34bd547..f45283f 100644
--- a/include/stick20_commands.h
+++ b/include/stick20_commands.h
@@ -52,6 +52,15 @@ namespace nitrokey {
class EnableEncryptedPartition : public PasswordCommand<CommandID::ENABLE_CRYPTED_PARI> {};
class EnableHiddenEncryptedPartition : public PasswordCommand<CommandID::ENABLE_HIDDEN_CRYPTED_PARI> {};
+ class SetUnencryptedVolumeReadOnlyAdmin :
+ public PasswordCommand<CommandID::ENABLE_ADMIN_READONLY_UNCRYPTED_LUN, PasswordKind::Admin> {};
+ class SetUnencryptedVolumeReadWriteAdmin :
+ public PasswordCommand<CommandID::ENABLE_ADMIN_READWRITE_UNCRYPTED_LUN, PasswordKind::Admin> {};
+ class SetEncryptedVolumeReadOnly :
+ public PasswordCommand<CommandID::ENABLE_ADMIN_READONLY_ENCRYPTED_LUN, PasswordKind::Admin> {};
+ class SetEncryptedVolumeReadWrite :
+ public PasswordCommand<CommandID::ENABLE_ADMIN_READWRITE_ENCRYPTED_LUN, PasswordKind::Admin> {};
+
//FIXME the volume disabling commands do not need password
class DisableEncryptedPartition : public PasswordCommand<CommandID::DISABLE_CRYPTED_PARI> {};
class DisableHiddenEncryptedPartition : public PasswordCommand<CommandID::DISABLE_HIDDEN_CRYPTED_PARI> {};
@@ -265,6 +274,12 @@ namespace nitrokey {
CommandTransaction;
};
+ class CheckSmartcardUsage : Command<CommandID::CHECK_SMARTCARD_USAGE> {
+ public:
+ typedef Transaction<command_id(), struct EmptyPayload, EmptyPayload>
+ CommandTransaction;
+ };
+
class GetSDCardOccupancy : Command<CommandID::SD_CARD_HIGH_WATERMARK> {
public:
struct ResponsePayload {