blob: f531cff3ee475df42ab14a02be1f57ebb34a9a48 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* Copyright (c) 2011 Soren Dreijer
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#pragma once
#include <boost/shared_ptr.hpp>
#include "Swiften/Base/String.h"
#include "Swiften/TLS/Certificate.h"
#include "Swiften/TLS/Schannel/SchannelUtil.h"
namespace Swift
{
class SchannelCertificate : public Certificate
{
public:
typedef boost::shared_ptr<SchannelCertificate> ref;
public:
SchannelCertificate(const ScopedCertContext& certCtxt);
SchannelCertificate(const ByteArray& der);
std::string getSubjectName() const
{
return m_subjectName;
}
std::vector<std::string> getCommonNames() const
{
return m_commonNames;
}
std::vector<std::string> getSRVNames() const
{
return m_srvNames;
}
std::vector<std::string> getDNSNames() const
{
return m_dnsNames;
}
std::vector<std::string> getXMPPAddresses() const
{
return m_xmppAddresses;
}
ByteArray toDER() const;
private:
void parse();
std::string wstrToStr(const std::wstring& wstr);
void addSRVName(const std::string& name)
{
m_srvNames.push_back(name);
}
void addDNSName(const std::string& name)
{
m_dnsNames.push_back(name);
}
void addXMPPAddress(const std::string& addr)
{
m_xmppAddresses.push_back(addr);
}
private:
ScopedCertContext m_cert;
std::string m_subjectName;
std::vector<std::string> m_commonNames;
std::vector<std::string> m_dnsNames;
std::vector<std::string> m_xmppAddresses;
std::vector<std::string> m_srvNames;
};
}
|