diff --git a/headers/os/app/KeyStore.h b/headers/os/app/KeyStore.h index 38486aadad..f89819c809 100644 --- a/headers/os/app/KeyStore.h +++ b/headers/os/app/KeyStore.h @@ -51,8 +51,7 @@ public: // Keyrings - status_t AddKeyring(const char* keyring, - const BKey& key); + status_t AddKeyring(const char* keyring); status_t RemoveKeyring(const char* keyring); status_t GetNextKeyring(uint32& cookie, diff --git a/src/bin/keystore/keystore.cpp b/src/bin/keystore/keystore.cpp index 865f433a98..6189c545f6 100644 --- a/src/bin/keystore/keystore.cpp +++ b/src/bin/keystore/keystore.cpp @@ -57,12 +57,11 @@ remove_password(const char* keyring, const char* identifier, int -add_keyring(const char* keyring, const char* passwordString) +add_keyring(const char* keyring) { BKeyStore keyStore; - BPasswordKey password(passwordString, B_KEY_PURPOSE_KEYRING, NULL); - status_t result = keyStore.AddKeyring(keyring, password); + status_t result = keyStore.AddKeyring(keyring); if (result != B_OK) { printf("failed to add keyring: %s\n", strerror(result)); return 2; @@ -257,9 +256,8 @@ print_usage(const char* name) " []\n", name); printf("\t\tRemoves the specified password from the specified keyring.\n\n"); - printf("\t%s add keyring \n", name); - printf("\t\tAdds a new keyring with the specified name, protected by the" - " supplied password.\n"); + printf("\t%s add keyring \n", name); + printf("\t\tAdds a new keyring with the specified name.\n"); printf("\t%s remove keyring \n", name); printf("\t\tRemoves the specified keyring.\n\n"); @@ -344,10 +342,10 @@ main(int argc, char* argv[]) password); } } else if (strcmp(argv[2], "keyring") == 0) { - if (argc < 5) + if (argc < 4) return print_usage(argv[0]); - return add_keyring(argv[3], argv[4]); + return add_keyring(argv[3]); } } else if (strcmp(argv[1], "remove") == 0) { if (argc < 3) diff --git a/src/kits/app/KeyStore.cpp b/src/kits/app/KeyStore.cpp index 9b616bb305..8540729b4b 100644 --- a/src/kits/app/KeyStore.cpp +++ b/src/kits/app/KeyStore.cpp @@ -187,16 +187,10 @@ BKeyStore::GetNextKey(const char* keyring, BKeyType type, BKeyPurpose purpose, status_t -BKeyStore::AddKeyring(const char* keyring, const BKey& key) +BKeyStore::AddKeyring(const char* keyring) { - BMessage keyMessage; - if (key.Flatten(keyMessage) != B_OK) - return B_BAD_VALUE; - BMessage message(KEY_STORE_ADD_KEYRING); message.AddString("keyring", keyring); - message.AddMessage("key", &keyMessage); - return _SendKeyMessage(message, NULL); } diff --git a/src/servers/keystore/KeyStoreServer.cpp b/src/servers/keystore/KeyStoreServer.cpp index 19fe75435e..b0c782e561 100644 --- a/src/servers/keystore/KeyStoreServer.cpp +++ b/src/servers/keystore/KeyStoreServer.cpp @@ -269,13 +269,12 @@ KeyStoreServer::MessageReceived(BMessage* message) { BMessage keyMessage; BString keyring; - if (message->FindString("keyring", &keyring) != B_OK - || message->FindMessage("key", &keyMessage) != B_OK) { + if (message->FindString("keyring", &keyring) != B_OK) { result = B_BAD_VALUE; break; } - result = _AddKeyring(keyring, keyMessage); + result = _AddKeyring(keyring); if (result == B_OK) _WriteKeyStoreDatabase(); @@ -681,12 +680,12 @@ KeyStoreServer::_FindKeyring(const BString& name) status_t -KeyStoreServer::_AddKeyring(const BString& name, const BMessage& keyMessage) +KeyStoreServer::_AddKeyring(const BString& name) { if (_FindKeyring(name) != NULL) return B_NAME_IN_USE; - Keyring* keyring = new(std::nothrow) Keyring(name, &keyMessage); + Keyring* keyring = new(std::nothrow) Keyring(name); if (keyring == NULL) return B_NO_MEMORY; diff --git a/src/servers/keystore/KeyStoreServer.h b/src/servers/keystore/KeyStoreServer.h index aa25f82ca8..4ab7a460fb 100644 --- a/src/servers/keystore/KeyStoreServer.h +++ b/src/servers/keystore/KeyStoreServer.h @@ -47,8 +47,7 @@ private: Keyring* _FindKeyring(const BString& name); - status_t _AddKeyring(const BString& name, - const BMessage& keyMessage); + status_t _AddKeyring(const BString& name); status_t _RemoveKeyring(const BString& name); status_t _UnlockKeyring(Keyring& keyring); diff --git a/src/servers/keystore/Keyring.cpp b/src/servers/keystore/Keyring.cpp index eff7c0051a..b472fffa4f 100644 --- a/src/servers/keystore/Keyring.cpp +++ b/src/servers/keystore/Keyring.cpp @@ -7,14 +7,12 @@ #include "Keyring.h" -Keyring::Keyring(const char* name, const BMessage* keyMessage) +Keyring::Keyring(const char* name) : fName(name), fUnlocked(false), fModified(false) { - if (keyMessage != NULL) - Unlock(*keyMessage); } diff --git a/src/servers/keystore/Keyring.h b/src/servers/keystore/Keyring.h index afbca03b14..978e312a4f 100644 --- a/src/servers/keystore/Keyring.h +++ b/src/servers/keystore/Keyring.h @@ -12,8 +12,7 @@ class Keyring { public: - Keyring(const char* name, - const BMessage* keyMessage = NULL); + Keyring(const char* name); ~Keyring(); const char* Name() const { return fName; }