diff options
author | Remko Tronçon <git@el-tramo.be> | 2014-02-01 11:48:54 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2014-02-02 09:42:58 (GMT) |
commit | f44ea24fda0f08195180215a30bc626d7c1907c5 (patch) | |
tree | a1bb160a98a497dbf01b82bbf559e99b6c1dfad9 /Swiften | |
parent | 3d881ddd0b65d3a2bc1213386fb75fd95e4de691 (diff) | |
download | swift-contrib-f44ea24fda0f08195180215a30bc626d7c1907c5.zip swift-contrib-f44ea24fda0f08195180215a30bc626d7c1907c5.tar.bz2 |
Sluift: Add new_certificate
Change-Id: If4e4ef98c00f15c0a88557860f0377843a8713c0
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/QA/TLSTest/CertificateTest.cpp | 14 | ||||
-rw-r--r-- | Swiften/TLS/CertificateFactory.h | 2 | ||||
-rw-r--r-- | Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h | 6 | ||||
-rw-r--r-- | Swiften/TLS/Schannel/SchannelCertificateFactory.h | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/Swiften/QA/TLSTest/CertificateTest.cpp b/Swiften/QA/TLSTest/CertificateTest.cpp index 2fa4c04..2089732 100644 --- a/Swiften/QA/TLSTest/CertificateTest.cpp +++ b/Swiften/QA/TLSTest/CertificateTest.cpp @@ -42,41 +42,41 @@ class CertificateTest : public CppUnit::TestFixture { } void testConstructFromDER() { - Certificate::ref testling = certificateFactory->createCertificateFromDER(certificateData); + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getCommonNames()[0]); } void testToDER() { - Certificate::ref testling = certificateFactory->createCertificateFromDER(certificateData); + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); CPPUNIT_ASSERT_EQUAL(certificateData, testling->toDER()); } /* void testGetSubjectName() { - Certificate::ref testling = certificateFactory->createCertificateFromDER(certificateData); + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData); CPPUNIT_ASSERT_EQUAL(std::string("/description=114072-VMk8pdi1aj5kTXxO/C=US/ST=Colorado/L=Denver/O=Peter Saint-Andre/OU=StartCom Trusted Certificate Member/CN=*.jabber.org/emailAddress=hostmaster@jabber.org"), testling->getSubjectName()); } */ void testGetCommonNames() { - Certificate::ref testling = certificateFactory->createCertificateFromDER(certificateData); + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling->getCommonNames().size())); CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getCommonNames()[0]); } void testGetSRVNames() { - Certificate::ref testling = certificateFactory->createCertificateFromDER(certificateData); + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling->getSRVNames().size())); CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getSRVNames()[0]); } void testGetDNSNames() { - Certificate::ref testling = certificateFactory->createCertificateFromDER(certificateData); + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(testling->getDNSNames().size())); CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getDNSNames()[0]); @@ -84,7 +84,7 @@ class CertificateTest : public CppUnit::TestFixture { } void testGetXMPPAddresses() { - Certificate::ref testling = certificateFactory->createCertificateFromDER(certificateData); + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling->getXMPPAddresses().size())); CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getXMPPAddresses()[0]); diff --git a/Swiften/TLS/CertificateFactory.h b/Swiften/TLS/CertificateFactory.h index 3e94082..e8971c3 100644 --- a/Swiften/TLS/CertificateFactory.h +++ b/Swiften/TLS/CertificateFactory.h @@ -13,6 +13,6 @@ namespace Swift { public: virtual ~CertificateFactory(); - virtual Certificate::ref createCertificateFromDER(const ByteArray& der) = 0; + virtual Certificate* createCertificateFromDER(const ByteArray& der) = 0; }; } diff --git a/Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h b/Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h index 52f134c..98376ae 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h +++ b/Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -12,8 +12,8 @@ namespace Swift { class OpenSSLCertificateFactory : public CertificateFactory { public: - virtual Certificate::ref createCertificateFromDER(const ByteArray& der) { - return Certificate::ref(new OpenSSLCertificate(der)); + virtual Certificate* createCertificateFromDER(const ByteArray& der) { + return new OpenSSLCertificate(der); } }; } diff --git a/Swiften/TLS/Schannel/SchannelCertificateFactory.h b/Swiften/TLS/Schannel/SchannelCertificateFactory.h index d09bb54..5a2b208 100644 --- a/Swiften/TLS/Schannel/SchannelCertificateFactory.h +++ b/Swiften/TLS/Schannel/SchannelCertificateFactory.h @@ -12,8 +12,8 @@ namespace Swift { class SchannelCertificateFactory : public CertificateFactory { public: - virtual Certificate::ref createCertificateFromDER(const ByteArray& der) { - return Certificate::ref(new SchannelCertificate(der)); + virtual Certificate* createCertificateFromDER(const ByteArray& der) { + return new SchannelCertificate(der); } }; } |