NSSKeyStore.h (1245B)
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 EncryptDecrypt(const nsACString& label, 23 const std::vector<uint8_t>& inBytes, 24 std::vector<uint8_t>& outBytes, 25 bool encrypt) override; 26 virtual nsresult SecretAvailable(const nsACString& label) override; 27 virtual ~NSSKeyStore(); 28 29 private: 30 nsresult InitToken(); 31 mozilla::UniquePK11SlotInfo mSlot = nullptr; 32 }; 33 34 #endif // NSSKeyStore_h