summaryrefslogtreecommitdiffstats
blob: 4204a6b617883d9fc45a9de537199b297bdb1eff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * Copyright (c) 2012 Isode Limited, London, England.
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#pragma once

#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/TLS/CertificateWithKey.h>

#define SECURITY_WIN32
#include <Windows.h>
#include <WinCrypt.h>

namespace Swift {
	class CAPICertificate : public Swift::CertificateWithKey {
		public:
			CAPICertificate(const std::string& capiUri);

			virtual ~CAPICertificate();

			virtual bool isNull() const;

			const std::string& getCertStoreName() const;

			const std::string& getCertName() const;

		private:
			void setUri (const std::string& capiUri);

		private:
			bool valid_;
			std::string uri_;

			HCERTSTORE certStoreHandle_;

			/* Parsed components of the uri_ */
			std::string certStore_;
			std::string certName_;
	};

PCCERT_CONTEXT findCertificateInStore (HCERTSTORE certStoreHandle, const std::string &certName);

}