Mercurial > hg > orthanc
comparison Core/WebServiceParameters.cpp @ 2022:fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 17 Jun 2016 17:09:50 +0200 |
parents | bd143a77eb7a |
children | 65b1ce7cb84f |
comparison
equal
deleted
inserted
replaced
2021:bd143a77eb7a | 2022:fefbe71c2272 |
---|---|
41 | 41 |
42 namespace Orthanc | 42 namespace Orthanc |
43 { | 43 { |
44 WebServiceParameters::WebServiceParameters() : | 44 WebServiceParameters::WebServiceParameters() : |
45 advancedFormat_(false), | 45 advancedFormat_(false), |
46 url_("http://localhost:8042/") | 46 url_("http://localhost:8042/"), |
47 { | 47 pkcs11Enabled_(false) |
48 { | |
49 } | |
50 | |
51 | |
52 void WebServiceParameters::ClearClientCertificate() | |
53 { | |
54 certificateFile_.clear(); | |
55 certificateKeyFile_.clear(); | |
56 certificateKeyPassword_.clear(); | |
48 } | 57 } |
49 | 58 |
50 | 59 |
51 void WebServiceParameters::SetClientCertificate(const std::string& certificateFile, | 60 void WebServiceParameters::SetClientCertificate(const std::string& certificateFile, |
52 const std::string& certificateKeyFile, | 61 const std::string& certificateKeyFile, |
90 void WebServiceParameters::FromJsonArray(const Json::Value& peer) | 99 void WebServiceParameters::FromJsonArray(const Json::Value& peer) |
91 { | 100 { |
92 assert(peer.isArray()); | 101 assert(peer.isArray()); |
93 | 102 |
94 advancedFormat_ = false; | 103 advancedFormat_ = false; |
104 pkcs11Enabled_ = false; | |
95 | 105 |
96 if (peer.size() != 1 && | 106 if (peer.size() != 1 && |
97 peer.size() != 3) | 107 peer.size() != 3) |
98 { | 108 { |
99 throw OrthancException(ErrorCode_BadFileFormat); | 109 throw OrthancException(ErrorCode_BadFileFormat); |
165 { | 175 { |
166 SetClientCertificate(GetStringMember(peer, "CertificateFile", ""), | 176 SetClientCertificate(GetStringMember(peer, "CertificateFile", ""), |
167 GetStringMember(peer, "CertificateKeyFile", ""), | 177 GetStringMember(peer, "CertificateKeyFile", ""), |
168 GetStringMember(peer, "CertificateKeyPassword", "")); | 178 GetStringMember(peer, "CertificateKeyPassword", "")); |
169 } | 179 } |
180 | |
181 if (peer.isMember("Pkcs11")) | |
182 { | |
183 if (peer["Pkcs11"].type() == Json::booleanValue) | |
184 { | |
185 pkcs11Enabled_ = peer["Pkcs11"].asBool(); | |
186 } | |
187 else | |
188 { | |
189 throw OrthancException(ErrorCode_BadFileFormat); | |
190 } | |
191 } | |
170 } | 192 } |
171 | 193 |
172 | 194 |
173 void WebServiceParameters::FromJson(const Json::Value& peer) | 195 void WebServiceParameters::FromJson(const Json::Value& peer) |
174 { | 196 { |