1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef NSSKeyStore_h 8 #define NSSKeyStore_h 9 10 #include "OSKeyStore.h" 11 #include "nsString.h" 12 13 class NSSKeyStore final : public AbstractOSKeyStore { 14 public: 15 NSSKeyStore(); 16 17 virtual nsresult RetrieveSecret(const nsACString& aLabel, 18 /* out */ nsACString& aSecret) override; 19 virtual nsresult StoreSecret(const nsACString& secret, 20 const nsACString& label) override; 21 virtual nsresult DeleteSecret(const nsACString& label) override; 22 virtual nsresult Lock() override; 23 virtual nsresult Unlock() override; 24 virtual nsresult EncryptDecrypt(const nsACString& label, 25 const std::vector<uint8_t>& inBytes, 26 std::vector<uint8_t>& outBytes, 27 bool encrypt) override; 28 virtual bool SecretAvailable(const nsACString& label) override; 29 virtual ~NSSKeyStore(); 30 31 private: 32 nsresult InitToken(); 33 mozilla::UniquePK11SlotInfo mSlot = nullptr; 34 }; 35 36 #endif // NSSKeyStore_h 37