util.h (861B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef util_h__ 6 #define util_h__ 7 8 #include "nspr.h" 9 #include "nss_scoped_ptrs.h" 10 11 #include <secmodt.h> 12 #include <string> 13 #include <vector> 14 15 #ifndef PORT_Malloc 16 #define PORT_Malloc PR_Malloc 17 #endif 18 19 enum PwDataType { PW_NONE = 0, PW_FROMFILE = 1, PW_PLAINTEXT = 2 }; 20 typedef struct { 21 PwDataType source; 22 char *data; 23 } PwData; 24 25 bool InitSlotPassword(void); 26 bool ChangeSlotPassword(void); 27 bool DBLoginIfNeeded(const ScopedPK11SlotInfo &slot); 28 std::string StringToHex(const ScopedSECItem &input); 29 std::vector<uint8_t> ReadInputData(std::string dataPath); 30 std::istream &GetStreamFromFileOrStdin(std::string &path, std::ifstream &ifs); 31 32 #endif // util_h__