| 1 | // |
| 2 | // PKCS12ContainerTest.h |
| 3 | // |
| 4 | // Definition of the PKCS12ContainerTest class. |
| 5 | // |
| 6 | // Copyright (c) 2012, Applied Informatics Software Engineering GmbH. |
| 7 | // and Contributors. |
| 8 | // |
| 9 | // SPDX-License-Identifier: BSL-1.0 |
| 10 | // |
| 11 | |
| 12 | |
| 13 | #ifndef PKCS12ContainerTest_INCLUDED |
| 14 | #define PKCS12ContainerTest_INCLUDED |
| 15 | |
| 16 | |
| 17 | #include "Poco/Crypto/Crypto.h" |
| 18 | #include "Poco/CppUnit/TestCase.h" |
| 19 | #include "Poco/Crypto/PKCS12Container.h" |
| 20 | #include "Poco/Crypto/X509Certificate.h" |
| 21 | |
| 22 | namespace Poco { |
| 23 | namespace Crypto { |
| 24 | class PKCS12Container; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | class PKCS12ContainerTest: public CppUnit::TestCase |
| 29 | { |
| 30 | public: |
| 31 | PKCS12ContainerTest(const std::string& name); |
| 32 | ~PKCS12ContainerTest(); |
| 33 | |
| 34 | void testFullPKCS12(); |
| 35 | void testCertsOnlyPKCS12(); |
| 36 | void testPEMReadWrite(); |
| 37 | |
| 38 | void setUp(); |
| 39 | void tearDown(); |
| 40 | |
| 41 | static CppUnit::Test* suite(); |
| 42 | |
| 43 | private: |
| 44 | std::string getTestFilesPath(const std::string& name, |
| 45 | const std::string& ext = "p12" ); |
| 46 | void certsOnly(const Poco::Crypto::PKCS12Container& pkcs12); |
| 47 | void certsOnlyList(const Poco::Crypto::PKCS12Container::CAList& caList, |
| 48 | const Poco::Crypto::PKCS12Container::CANameList& caNamesList, |
| 49 | const std::vector<int>& certOrder); |
| 50 | void full(const Poco::Crypto::PKCS12Container& pkcs12); |
| 51 | void fullCert(const Poco::Crypto::X509Certificate& x509); |
| 52 | void fullList(const Poco::Crypto::PKCS12Container::CAList& caList, |
| 53 | const Poco::Crypto::PKCS12Container::CANameList& caNamesList, |
| 54 | const std::vector<int>& certOrder); |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | #endif // PKCS12ContainerTest_INCLUDED |
| 59 | |