zeroc-ice 3.7.3 → 3.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/Communicator.cpp +3 -0
- data/ext/Config.h +11 -0
- data/ext/Types.cpp +18 -2
- data/ext/Util.cpp +15 -3
- data/ext/Util.h +36 -0
- data/ext/ice/cpp/include/Ice/Exception.h +3 -3
- data/ext/ice/cpp/include/Ice/Functional.h +3 -1
- data/ext/ice/cpp/include/Ice/IconvStringConverter.h +1 -1
- data/ext/ice/cpp/include/Ice/Initialize.h +1 -1
- data/ext/ice/cpp/include/Ice/Object.h +7 -0
- data/ext/ice/cpp/include/Ice/Optional.h +1 -1
- data/ext/ice/cpp/include/Ice/OutgoingAsync.h +15 -0
- data/ext/ice/cpp/include/Ice/Proxy.h +56 -25
- data/ext/ice/cpp/include/Ice/Service.h +1 -1
- data/ext/ice/cpp/include/IceSSL/Plugin.h +142 -0
- data/ext/ice/cpp/include/IceUtil/Config.h +3 -2
- data/ext/ice/cpp/include/IceUtil/Functional.h +3 -1
- data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +4 -4
- data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/BuiltinSequences.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Communicator.h +10 -4
- data/ext/ice/cpp/include/generated/Ice/CommunicatorF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Connection.h +58 -15
- data/ext/ice/cpp/include/generated/Ice/ConnectionF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Current.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Endpoint.h +50 -14
- data/ext/ice/cpp/include/generated/Ice/EndpointF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/EndpointTypes.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/FacetMap.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Identity.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ImplicitContext.h +8 -2
- data/ext/ice/cpp/include/generated/Ice/ImplicitContextF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +62 -2
- data/ext/ice/cpp/include/generated/Ice/InstrumentationF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/LocalException.h +523 -127
- data/ext/ice/cpp/include/generated/Ice/Locator.h +62 -14
- data/ext/ice/cpp/include/generated/Ice/LocatorF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Logger.h +8 -2
- data/ext/ice/cpp/include/generated/Ice/LoggerF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Metrics.h +79 -27
- data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +8 -2
- data/ext/ice/cpp/include/generated/Ice/ObjectAdapterF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +8 -2
- data/ext/ice/cpp/include/generated/Ice/Plugin.h +14 -2
- data/ext/ice/cpp/include/generated/Ice/PluginF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Process.h +10 -4
- data/ext/ice/cpp/include/generated/Ice/ProcessF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/Properties.h +8 -2
- data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +11 -5
- data/ext/ice/cpp/include/generated/Ice/PropertiesF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +26 -8
- data/ext/ice/cpp/include/generated/Ice/Router.h +18 -6
- data/ext/ice/cpp/include/generated/Ice/RouterF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ServantLocator.h +8 -2
- data/ext/ice/cpp/include/generated/Ice/ServantLocatorF.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/SliceChecksumDict.h +2 -2
- data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +14 -2
- data/ext/ice/cpp/include/generated/Ice/Version.h +2 -2
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +10 -5
- data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +2 -2
- data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +8 -3
- data/ext/ice/cpp/src/Ice/ArgVector.cpp +1 -1
- data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Communicator.cpp +2 -2
- data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Connection.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ConnectionF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +3 -3
- data/ext/ice/cpp/src/Ice/Current.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Endpoint.cpp +2 -2
- data/ext/ice/cpp/src/Ice/EndpointF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +2 -2
- data/ext/ice/cpp/src/Ice/FacetMap.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Identity.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +1 -1
- data/ext/ice/cpp/src/Ice/Initialize.cpp +1 -1
- data/ext/ice/cpp/src/Ice/InputStream.cpp +29 -14
- data/ext/ice/cpp/src/Ice/Instance.cpp +3 -0
- data/ext/ice/cpp/src/Ice/Instance.h +2 -0
- data/ext/ice/cpp/src/Ice/Instrumentation.cpp +2 -2
- data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/LocalException.cpp +398 -2
- data/ext/ice/cpp/src/Ice/Locator.cpp +32 -2
- data/ext/ice/cpp/src/Ice/LocatorF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +3 -3
- data/ext/ice/cpp/src/Ice/Logger.cpp +2 -2
- data/ext/ice/cpp/src/Ice/LoggerF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Metrics.cpp +8 -2
- data/ext/ice/cpp/src/Ice/Network.cpp +1 -1
- data/ext/ice/cpp/src/Ice/Network.h +0 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +4 -4
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +8 -8
- data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Plugin.cpp +2 -2
- data/ext/ice/cpp/src/Ice/PluginF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Process.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ProcessF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Properties.cpp +2 -2
- data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +2 -2
- data/ext/ice/cpp/src/Ice/PropertiesF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/PropertyNames.cpp +6 -3
- data/ext/ice/cpp/src/Ice/PropertyNames.h +1 -1
- data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +9 -0
- data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +8 -2
- data/ext/ice/cpp/src/Ice/RetryQueue.cpp +5 -2
- data/ext/ice/cpp/src/Ice/Router.cpp +2 -2
- data/ext/ice/cpp/src/Ice/RouterF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/RouterInfo.cpp +6 -2
- data/ext/ice/cpp/src/Ice/SHA1.cpp +2 -0
- data/ext/ice/cpp/src/Ice/ServantLocator.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +2 -2
- data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +2 -2
- data/ext/ice/cpp/src/Ice/StreamSocket.cpp +0 -0
- data/ext/ice/cpp/src/Ice/Thread.cpp +2 -2
- data/ext/ice/cpp/src/Ice/ThreadPool.cpp +5 -1
- data/ext/ice/cpp/src/Ice/ThreadPool.h +0 -4
- data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +0 -0
- data/ext/ice/cpp/src/Ice/ValueFactory.cpp +2 -2
- data/ext/ice/cpp/src/Ice/Version.cpp +2 -2
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +2 -2
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +491 -6
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +2 -2
- data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +16 -4
- data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +12 -1
- data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +23 -1
- data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +2 -2
- data/ext/ice/cpp/src/IceSSL/ConnectionInfoF.cpp +2 -2
- data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +2 -2
- data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +124 -19
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +60 -1
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +105 -2
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +1 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +2 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.cpp +114 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.h +21 -0
- data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +142 -1
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +117 -3
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +1 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +20 -1
- data/ext/ice/cpp/src/IceSSL/SSLEngine.h +4 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +133 -2
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +151 -89
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +1 -0
- data/ext/ice/cpp/src/IceSSL/Util.cpp +0 -0
- data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +6 -0
- data/ext/ice/cpp/src/IceUtil/Time.cpp +8 -10
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +6 -2
- data/ext/ice/cpp/src/Slice/JavaUtil.cpp +12 -4
- data/ext/ice/cpp/src/Slice/PHPUtil.cpp +4 -0
- data/ext/ice/cpp/src/Slice/Parser.cpp +11 -7
- data/ext/ice/cpp/src/Slice/Parser.h +2 -2
- data/ext/ice/cpp/src/Slice/Preprocessor.cpp +12 -0
- data/ext/ice/cpp/src/Slice/Preprocessor.h +1 -1
- data/ext/ice/cpp/src/Slice/Python.cpp +1 -1
- data/ext/ice/cpp/src/Slice/PythonUtil.cpp +17 -5
- data/ext/ice/cpp/src/Slice/Scanner.cpp +621 -369
- data/ext/ice/mcpp/CMakeLists.txt +80 -0
- data/ext/ice/mcpp/expand.c +6 -6
- data/ice.gemspec +1 -1
- data/lib/Glacier2/Metrics.rb +1 -1
- data/lib/Glacier2/PermissionsVerifier.rb +1 -1
- data/lib/Glacier2/PermissionsVerifierF.rb +1 -1
- data/lib/Glacier2/Router.rb +1 -1
- data/lib/Glacier2/RouterF.rb +1 -1
- data/lib/Glacier2/SSLInfo.rb +1 -1
- data/lib/Glacier2/Session.rb +1 -1
- data/lib/Ice/BuiltinSequences.rb +1 -1
- data/lib/Ice/Communicator.rb +1 -1
- data/lib/Ice/CommunicatorF.rb +1 -1
- data/lib/Ice/Connection.rb +1 -1
- data/lib/Ice/ConnectionF.rb +1 -1
- data/lib/Ice/Current.rb +1 -1
- data/lib/Ice/Endpoint.rb +1 -1
- data/lib/Ice/EndpointF.rb +1 -1
- data/lib/Ice/EndpointTypes.rb +1 -1
- data/lib/Ice/FacetMap.rb +1 -1
- data/lib/Ice/Identity.rb +1 -1
- data/lib/Ice/ImplicitContext.rb +1 -1
- data/lib/Ice/ImplicitContextF.rb +1 -1
- data/lib/Ice/Instrumentation.rb +1 -1
- data/lib/Ice/InstrumentationF.rb +1 -1
- data/lib/Ice/LocalException.rb +1 -1
- data/lib/Ice/Locator.rb +1 -1
- data/lib/Ice/LocatorF.rb +1 -1
- data/lib/Ice/Logger.rb +1 -1
- data/lib/Ice/LoggerF.rb +1 -1
- data/lib/Ice/Metrics.rb +1 -1
- data/lib/Ice/ObjectAdapter.rb +1 -1
- data/lib/Ice/ObjectAdapterF.rb +1 -1
- data/lib/Ice/ObjectFactory.rb +1 -1
- data/lib/Ice/Plugin.rb +1 -1
- data/lib/Ice/PluginF.rb +1 -1
- data/lib/Ice/Process.rb +1 -1
- data/lib/Ice/ProcessF.rb +1 -1
- data/lib/Ice/Properties.rb +1 -1
- data/lib/Ice/PropertiesAdmin.rb +1 -1
- data/lib/Ice/PropertiesF.rb +1 -1
- data/lib/Ice/RemoteLogger.rb +1 -1
- data/lib/Ice/Router.rb +1 -1
- data/lib/Ice/RouterF.rb +1 -1
- data/lib/Ice/ServantLocator.rb +1 -1
- data/lib/Ice/ServantLocatorF.rb +1 -1
- data/lib/Ice/SliceChecksumDict.rb +1 -1
- data/lib/Ice/ValueFactory.rb +1 -1
- data/lib/Ice/Version.rb +1 -1
- data/lib/IceBox/IceBox.rb +1 -1
- data/lib/IceGrid/Admin.rb +1 -1
- data/lib/IceGrid/Descriptor.rb +1 -1
- data/lib/IceGrid/Exception.rb +1 -1
- data/lib/IceGrid/FileParser.rb +1 -1
- data/lib/IceGrid/PluginFacade.rb +1 -1
- data/lib/IceGrid/Registry.rb +1 -1
- data/lib/IceGrid/Session.rb +1 -1
- data/lib/IceGrid/UserAccountMapper.rb +1 -1
- data/lib/IcePatch2/FileInfo.rb +1 -1
- data/lib/IcePatch2/FileServer.rb +1 -1
- data/lib/IceStorm/IceStorm.rb +1 -1
- data/lib/IceStorm/Metrics.rb +1 -1
- data/slice/Ice/Communicator.ice +1 -1
- data/slice/IceBox/IceBox.ice +17 -2
- data/slice/IceDiscovery/IceDiscovery.ice +56 -0
- metadata +4 -4
@@ -130,3 +130,117 @@ ICEregisterIceSSL(bool loadOnInitialize)
|
|
130
130
|
{
|
131
131
|
Ice::registerIceSSL(loadOnInitialize);
|
132
132
|
}
|
133
|
+
|
134
|
+
IceSSL::TrustError
|
135
|
+
IceSSL::getTrustError(const IceSSL::ConnectionInfoPtr& info)
|
136
|
+
{
|
137
|
+
ExtendedConnectionInfoPtr extendedInfo = ICE_DYNAMIC_CAST(ExtendedConnectionInfo, info);
|
138
|
+
if (extendedInfo)
|
139
|
+
{
|
140
|
+
return extendedInfo->errorCode;
|
141
|
+
}
|
142
|
+
return info->verified ? IceSSL::ICE_ENUM(TrustError, NoError) : IceSSL::ICE_ENUM(TrustError, UnknownTrustFailure);
|
143
|
+
}
|
144
|
+
|
145
|
+
std::string
|
146
|
+
IceSSL::getTrustErrorDescription(TrustError error)
|
147
|
+
{
|
148
|
+
switch(error)
|
149
|
+
{
|
150
|
+
case IceSSL::ICE_ENUM(TrustError, NoError):
|
151
|
+
{
|
152
|
+
return "no error";
|
153
|
+
}
|
154
|
+
case IceSSL::ICE_ENUM(TrustError, ChainTooLong):
|
155
|
+
{
|
156
|
+
return "the certificate chain length is greater than the specified maximum depth";
|
157
|
+
}
|
158
|
+
case IceSSL::ICE_ENUM(TrustError, HasExcludedNameConstraint):
|
159
|
+
{
|
160
|
+
return "the X509 chain is invalid because a certificate has excluded a name constraint";
|
161
|
+
}
|
162
|
+
case IceSSL::ICE_ENUM(TrustError, HasNonDefinedNameConstraint):
|
163
|
+
{
|
164
|
+
return "the certificate has an undefined name constraint";
|
165
|
+
}
|
166
|
+
case IceSSL::ICE_ENUM(TrustError, HasNonPermittedNameConstraint):
|
167
|
+
{
|
168
|
+
return "the certificate has a non permitted name constrain";
|
169
|
+
}
|
170
|
+
case IceSSL::ICE_ENUM(TrustError, HasNonSupportedCriticalExtension):
|
171
|
+
{
|
172
|
+
return "the certificate does not support a critical extension";
|
173
|
+
}
|
174
|
+
case IceSSL::ICE_ENUM(TrustError, HasNonSupportedNameConstraint):
|
175
|
+
{
|
176
|
+
return "the certificate does not have a supported name constraint or has a name constraint that "
|
177
|
+
"is unsupported";
|
178
|
+
}
|
179
|
+
case IceSSL::ICE_ENUM(TrustError, HostNameMismatch):
|
180
|
+
{
|
181
|
+
return "a host name mismatch has occurred";
|
182
|
+
}
|
183
|
+
case IceSSL::ICE_ENUM(TrustError, InvalidBasicConstraints):
|
184
|
+
{
|
185
|
+
return "the X509 chain is invalid due to invalid basic constraints";
|
186
|
+
}
|
187
|
+
case IceSSL::ICE_ENUM(TrustError, InvalidExtension):
|
188
|
+
{
|
189
|
+
return "the X509 chain is invalid due to an invalid extension";
|
190
|
+
}
|
191
|
+
case IceSSL::ICE_ENUM(TrustError, InvalidNameConstraints):
|
192
|
+
{
|
193
|
+
return "the X509 chain is invalid due to invalid name constraints";
|
194
|
+
}
|
195
|
+
case IceSSL::ICE_ENUM(TrustError, InvalidPolicyConstraints):
|
196
|
+
{
|
197
|
+
return "the X509 chain is invalid due to invalid policy constraints";
|
198
|
+
}
|
199
|
+
case IceSSL::ICE_ENUM(TrustError, InvalidPurpose):
|
200
|
+
{
|
201
|
+
return "the supplied certificate cannot be used for the specified purpose";
|
202
|
+
}
|
203
|
+
case IceSSL::ICE_ENUM(TrustError, InvalidSignature):
|
204
|
+
{
|
205
|
+
return "the X509 chain is invalid due to an invalid certificate signature";
|
206
|
+
}
|
207
|
+
case IceSSL::ICE_ENUM(TrustError, InvalidTime):
|
208
|
+
{
|
209
|
+
return "the X509 chain is not valid due to an invalid time value, such as a value that indicates an "
|
210
|
+
"expired certificate";
|
211
|
+
}
|
212
|
+
case IceSSL::ICE_ENUM(TrustError, NotTrusted):
|
213
|
+
{
|
214
|
+
return "the certificate is explicitly distrusted";
|
215
|
+
}
|
216
|
+
case IceSSL::ICE_ENUM(TrustError, PartialChain):
|
217
|
+
{
|
218
|
+
return "the X509 chain could not be built up to the root certificate";
|
219
|
+
}
|
220
|
+
case IceSSL::ICE_ENUM(TrustError, RevocationStatusUnknown):
|
221
|
+
{
|
222
|
+
return "it is not possible to determine whether the certificate has been revoked";
|
223
|
+
}
|
224
|
+
case IceSSL::ICE_ENUM(TrustError, Revoked):
|
225
|
+
{
|
226
|
+
return "the X509 chain is invalid due to a revoked certificate";
|
227
|
+
}
|
228
|
+
case IceSSL::ICE_ENUM(TrustError, UntrustedRoot):
|
229
|
+
{
|
230
|
+
return "the X509 chain is invalid due to an untrusted root certificate";
|
231
|
+
}
|
232
|
+
case IceSSL::ICE_ENUM(TrustError, UnknownTrustFailure):
|
233
|
+
{
|
234
|
+
return "unknown failure";
|
235
|
+
}
|
236
|
+
}
|
237
|
+
assert(false);
|
238
|
+
return "unknown failure";
|
239
|
+
}
|
240
|
+
|
241
|
+
std::string
|
242
|
+
IceSSL::getHost(const IceSSL::ConnectionInfoPtr& info)
|
243
|
+
{
|
244
|
+
ExtendedConnectionInfoPtr extendedInfo = ICE_DYNAMIC_CAST(ExtendedConnectionInfo, info);
|
245
|
+
return extendedInfo ? extendedInfo->host : "";
|
246
|
+
}
|
@@ -7,11 +7,32 @@
|
|
7
7
|
|
8
8
|
#include <IceSSL/Plugin.h>
|
9
9
|
#include <IceSSL/SSLEngineF.h>
|
10
|
+
#include <IceSSL/ConnectionInfo.h>
|
10
11
|
#include <Ice/CommunicatorF.h>
|
11
12
|
|
12
13
|
namespace IceSSL
|
13
14
|
{
|
14
15
|
|
16
|
+
class ExtendedConnectionInfo : public ConnectionInfo
|
17
|
+
{
|
18
|
+
public:
|
19
|
+
|
20
|
+
TrustError errorCode;
|
21
|
+
std::string host;
|
22
|
+
};
|
23
|
+
ICE_DEFINE_PTR(ExtendedConnectionInfoPtr, ExtendedConnectionInfo);
|
24
|
+
|
25
|
+
// TODO: This class provides new certificate virtual methods that canot be added directly to the certificate class
|
26
|
+
// without breaking binary compatibility. The class can be removed once the relevant methods can be marked as virtual in
|
27
|
+
// the certificate class in the next major release (3.8.x).
|
28
|
+
class ICESSL_API CertificateExtendedInfo
|
29
|
+
{
|
30
|
+
public:
|
31
|
+
|
32
|
+
virtual unsigned int getKeyUsage() const = 0;
|
33
|
+
virtual unsigned int getExtendedKeyUsage() const = 0;
|
34
|
+
};
|
35
|
+
|
15
36
|
class ICESSL_API PluginI : public virtual IceSSL::Plugin
|
16
37
|
{
|
17
38
|
public:
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// Copyright (c) ZeroC, Inc. All rights reserved.
|
3
3
|
//
|
4
4
|
|
5
|
-
#include <IceSSL/
|
5
|
+
#include <IceSSL/PluginI.h>
|
6
6
|
#include <IceSSL/SChannel.h>
|
7
7
|
#include <IceSSL/CertificateI.h>
|
8
8
|
#include <IceSSL/Util.h>
|
@@ -59,6 +59,7 @@ private:
|
|
59
59
|
|
60
60
|
class SChannelCertificateI : public SChannel::Certificate,
|
61
61
|
public CertificateI,
|
62
|
+
public IceSSL::CertificateExtendedInfo,
|
62
63
|
public IceUtil::Mutex
|
63
64
|
{
|
64
65
|
public:
|
@@ -94,6 +95,9 @@ protected:
|
|
94
95
|
|
95
96
|
private:
|
96
97
|
|
98
|
+
virtual unsigned int getKeyUsage() const;
|
99
|
+
virtual unsigned int getExtendedKeyUsage() const;
|
100
|
+
|
97
101
|
CERT_SIGNED_CONTENT_INFO* _cert;
|
98
102
|
CERT_INFO* _certInfo;
|
99
103
|
CertInfoHolderPtr _certInfoHolder;
|
@@ -557,6 +561,143 @@ SChannelCertificateI::loadX509Extensions() const
|
|
557
561
|
}
|
558
562
|
}
|
559
563
|
|
564
|
+
unsigned int
|
565
|
+
SChannelCertificateI::getKeyUsage() const
|
566
|
+
{
|
567
|
+
unsigned int keyUsage = 0;
|
568
|
+
BYTE usage[2];
|
569
|
+
if(CertGetIntendedKeyUsage(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, _certInfo, usage, 2))
|
570
|
+
{
|
571
|
+
if (usage[0] & CERT_DIGITAL_SIGNATURE_KEY_USAGE)
|
572
|
+
{
|
573
|
+
keyUsage |= KEY_USAGE_DIGITAL_SIGNATURE;
|
574
|
+
}
|
575
|
+
if (usage[0] & CERT_NON_REPUDIATION_KEY_USAGE)
|
576
|
+
{
|
577
|
+
keyUsage |= KEY_USAGE_NON_REPUDIATION;
|
578
|
+
}
|
579
|
+
if (usage[0] & CERT_KEY_ENCIPHERMENT_KEY_USAGE)
|
580
|
+
{
|
581
|
+
keyUsage |= KEY_USAGE_KEY_ENCIPHERMENT;
|
582
|
+
}
|
583
|
+
if (usage[0] & CERT_DATA_ENCIPHERMENT_KEY_USAGE)
|
584
|
+
{
|
585
|
+
keyUsage |= KEY_USAGE_DATA_ENCIPHERMENT;
|
586
|
+
}
|
587
|
+
if (usage[0] & CERT_KEY_AGREEMENT_KEY_USAGE)
|
588
|
+
{
|
589
|
+
keyUsage |= KEY_USAGE_KEY_AGREEMENT;
|
590
|
+
}
|
591
|
+
if (usage[0] & CERT_KEY_CERT_SIGN_KEY_USAGE)
|
592
|
+
{
|
593
|
+
keyUsage |= KEY_USAGE_KEY_CERT_SIGN;
|
594
|
+
}
|
595
|
+
if(usage[0] & CERT_CRL_SIGN_KEY_USAGE)
|
596
|
+
{
|
597
|
+
keyUsage |= KEY_USAGE_CRL_SIGN;
|
598
|
+
}
|
599
|
+
if(usage[0] & CERT_ENCIPHER_ONLY_KEY_USAGE)
|
600
|
+
{
|
601
|
+
keyUsage |= KEY_USAGE_ENCIPHER_ONLY;
|
602
|
+
}
|
603
|
+
if(usage[1] & CERT_DECIPHER_ONLY_KEY_USAGE)
|
604
|
+
{
|
605
|
+
keyUsage |= KEY_USAGE_DECIPHER_ONLY;
|
606
|
+
}
|
607
|
+
}
|
608
|
+
else if(GetLastError())
|
609
|
+
{
|
610
|
+
throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
|
611
|
+
}
|
612
|
+
return keyUsage;
|
613
|
+
}
|
614
|
+
|
615
|
+
unsigned int
|
616
|
+
SChannelCertificateI::getExtendedKeyUsage() const
|
617
|
+
{
|
618
|
+
unsigned int extendedKeyUsage = 0;
|
619
|
+
const CERT_CONTEXT* certContext = CertCreateCertificateContext(X509_ASN_ENCODING,
|
620
|
+
_cert->ToBeSigned.pbData,
|
621
|
+
_cert->ToBeSigned.cbData);
|
622
|
+
if(certContext == 0)
|
623
|
+
{
|
624
|
+
throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
|
625
|
+
}
|
626
|
+
try
|
627
|
+
{
|
628
|
+
DWORD cbUsage;
|
629
|
+
if(!CertGetEnhancedKeyUsage(certContext, 0, 0, &cbUsage))
|
630
|
+
{
|
631
|
+
if(GetLastError() == CRYPT_E_NOT_FOUND)
|
632
|
+
{
|
633
|
+
return 0;
|
634
|
+
}
|
635
|
+
else
|
636
|
+
{
|
637
|
+
throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
|
638
|
+
}
|
639
|
+
}
|
640
|
+
|
641
|
+
if (cbUsage > 0)
|
642
|
+
{
|
643
|
+
vector<unsigned char> pUsage;
|
644
|
+
pUsage.resize(cbUsage);
|
645
|
+
if(!CertGetEnhancedKeyUsage(certContext, 0, reinterpret_cast<CERT_ENHKEY_USAGE*>(&pUsage[0]), &cbUsage))
|
646
|
+
{
|
647
|
+
if(GetLastError() == CRYPT_E_NOT_FOUND)
|
648
|
+
{
|
649
|
+
return 0;
|
650
|
+
}
|
651
|
+
else
|
652
|
+
{
|
653
|
+
throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
|
654
|
+
}
|
655
|
+
}
|
656
|
+
|
657
|
+
CERT_ENHKEY_USAGE* enkeyUsage = reinterpret_cast<CERT_ENHKEY_USAGE*>(&pUsage[0]);
|
658
|
+
for(DWORD i = 0; i < enkeyUsage->cUsageIdentifier; i++)
|
659
|
+
{
|
660
|
+
LPSTR oid = enkeyUsage->rgpszUsageIdentifier[i];
|
661
|
+
if(strcmp(oid, szOID_ANY_ENHANCED_KEY_USAGE) == 0)
|
662
|
+
{
|
663
|
+
extendedKeyUsage |= EXTENDED_KEY_USAGE_ANY_KEY_USAGE;
|
664
|
+
}
|
665
|
+
if(strcmp(oid, szOID_PKIX_KP_SERVER_AUTH) == 0)
|
666
|
+
{
|
667
|
+
extendedKeyUsage |= EXTENDED_KEY_USAGE_SERVER_AUTH;
|
668
|
+
}
|
669
|
+
if(strcmp(oid, szOID_PKIX_KP_CLIENT_AUTH) == 0)
|
670
|
+
{
|
671
|
+
extendedKeyUsage |= EXTENDED_KEY_USAGE_CLIENT_AUTH;
|
672
|
+
}
|
673
|
+
if(strcmp(oid, szOID_PKIX_KP_CODE_SIGNING) == 0)
|
674
|
+
{
|
675
|
+
extendedKeyUsage |= EXTENDED_KEY_USAGE_CODE_SIGNING;
|
676
|
+
}
|
677
|
+
if(strcmp(oid, szOID_PKIX_KP_EMAIL_PROTECTION) == 0)
|
678
|
+
{
|
679
|
+
extendedKeyUsage |= EXTENDED_KEY_USAGE_EMAIL_PROTECTION;
|
680
|
+
}
|
681
|
+
if(strcmp(oid, szOID_PKIX_KP_TIMESTAMP_SIGNING) == 0)
|
682
|
+
{
|
683
|
+
extendedKeyUsage |= EXTENDED_KEY_USAGE_TIME_STAMPING;
|
684
|
+
}
|
685
|
+
if(strcmp(oid, szOID_PKIX_KP_OCSP_SIGNING) == 0)
|
686
|
+
{
|
687
|
+
extendedKeyUsage |= EXTENDED_KEY_USAGE_OCSP_SIGNING;
|
688
|
+
}
|
689
|
+
}
|
690
|
+
}
|
691
|
+
CertFreeCertificateContext(certContext);
|
692
|
+
}
|
693
|
+
catch(...)
|
694
|
+
{
|
695
|
+
CertFreeCertificateContext(certContext);
|
696
|
+
throw;
|
697
|
+
}
|
698
|
+
return extendedKeyUsage;
|
699
|
+
}
|
700
|
+
|
560
701
|
SChannel::CertificatePtr
|
561
702
|
SChannel::Certificate::create(CERT_SIGNED_CONTENT_INFO* cert)
|
562
703
|
{
|
@@ -9,6 +9,7 @@
|
|
9
9
|
#include <IceSSL/ConnectionInfo.h>
|
10
10
|
#include <IceSSL/Instance.h>
|
11
11
|
#include <IceSSL/SChannelEngine.h>
|
12
|
+
#include <IceSSL/PluginI.h>
|
12
13
|
#include <IceSSL/Util.h>
|
13
14
|
#include <Ice/Communicator.h>
|
14
15
|
#include <Ice/LoggerUtil.h>
|
@@ -19,6 +20,10 @@ using namespace std;
|
|
19
20
|
using namespace Ice;
|
20
21
|
using namespace IceSSL;
|
21
22
|
|
23
|
+
#ifndef CERT_CHAIN_DISABLE_AIA
|
24
|
+
# define CERT_CHAIN_DISABLE_AIA 0x00002000
|
25
|
+
#endif
|
26
|
+
|
22
27
|
namespace
|
23
28
|
{
|
24
29
|
|
@@ -47,6 +52,93 @@ protocolName(DWORD protocol)
|
|
47
52
|
}
|
48
53
|
}
|
49
54
|
|
55
|
+
TrustError
|
56
|
+
trustStatusToTrustError(DWORD status)
|
57
|
+
{
|
58
|
+
if (status & CERT_TRUST_NO_ERROR)
|
59
|
+
{
|
60
|
+
return IceSSL::ICE_ENUM(TrustError, NoError);
|
61
|
+
}
|
62
|
+
if ((status & CERT_TRUST_IS_UNTRUSTED_ROOT) ||
|
63
|
+
(status & CERT_TRUST_IS_CYCLIC) ||
|
64
|
+
(status & CERT_TRUST_CTL_IS_NOT_TIME_VALID) ||
|
65
|
+
(status & CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID) ||
|
66
|
+
(status & CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE))
|
67
|
+
{
|
68
|
+
return IceSSL::ICE_ENUM(TrustError, UntrustedRoot);
|
69
|
+
}
|
70
|
+
if (status & CERT_TRUST_IS_EXPLICIT_DISTRUST)
|
71
|
+
{
|
72
|
+
return IceSSL::ICE_ENUM(TrustError, NotTrusted);
|
73
|
+
}
|
74
|
+
if (status & CERT_TRUST_IS_PARTIAL_CHAIN)
|
75
|
+
{
|
76
|
+
return IceSSL::ICE_ENUM(TrustError, PartialChain);
|
77
|
+
}
|
78
|
+
if (status & CERT_TRUST_INVALID_BASIC_CONSTRAINTS)
|
79
|
+
{
|
80
|
+
return IceSSL::ICE_ENUM(TrustError, InvalidBasicConstraints);
|
81
|
+
}
|
82
|
+
if (status & CERT_TRUST_IS_NOT_SIGNATURE_VALID)
|
83
|
+
{
|
84
|
+
return IceSSL::ICE_ENUM(TrustError, InvalidSignature);
|
85
|
+
}
|
86
|
+
if (status & CERT_TRUST_IS_NOT_VALID_FOR_USAGE)
|
87
|
+
{
|
88
|
+
return IceSSL::ICE_ENUM(TrustError, InvalidPurpose);
|
89
|
+
}
|
90
|
+
if (status & CERT_TRUST_IS_REVOKED)
|
91
|
+
{
|
92
|
+
return IceSSL::ICE_ENUM(TrustError, Revoked);
|
93
|
+
}
|
94
|
+
if (status & CERT_TRUST_INVALID_EXTENSION)
|
95
|
+
{
|
96
|
+
return IceSSL::ICE_ENUM(TrustError, InvalidExtension);
|
97
|
+
}
|
98
|
+
if (status & CERT_TRUST_INVALID_POLICY_CONSTRAINTS)
|
99
|
+
{
|
100
|
+
return IceSSL::ICE_ENUM(TrustError, InvalidPolicyConstraints);
|
101
|
+
}
|
102
|
+
if (status & CERT_TRUST_INVALID_NAME_CONSTRAINTS)
|
103
|
+
{
|
104
|
+
return IceSSL::ICE_ENUM(TrustError, InvalidNameConstraints);
|
105
|
+
}
|
106
|
+
if (status & CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT)
|
107
|
+
{
|
108
|
+
return IceSSL::ICE_ENUM(TrustError, HasNonSupportedNameConstraint);
|
109
|
+
}
|
110
|
+
if (status & CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT)
|
111
|
+
{
|
112
|
+
return IceSSL::ICE_ENUM(TrustError, HasNonDefinedNameConstraint);
|
113
|
+
}
|
114
|
+
if (status & CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT)
|
115
|
+
{
|
116
|
+
return IceSSL::ICE_ENUM(TrustError, HasNonPermittedNameConstraint);
|
117
|
+
}
|
118
|
+
if (status & CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT)
|
119
|
+
{
|
120
|
+
return IceSSL::ICE_ENUM(TrustError, HasExcludedNameConstraint);
|
121
|
+
}
|
122
|
+
if (status & CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY)
|
123
|
+
{
|
124
|
+
return IceSSL::ICE_ENUM(TrustError, InvalidPolicyConstraints);
|
125
|
+
}
|
126
|
+
if (status & CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT)
|
127
|
+
{
|
128
|
+
return IceSSL::ICE_ENUM(TrustError, HasNonSupportedCriticalExtension);
|
129
|
+
}
|
130
|
+
if (status & CERT_TRUST_IS_OFFLINE_REVOCATION ||
|
131
|
+
status & CERT_TRUST_REVOCATION_STATUS_UNKNOWN)
|
132
|
+
{
|
133
|
+
return IceSSL::ICE_ENUM(TrustError, RevocationStatusUnknown);
|
134
|
+
}
|
135
|
+
if (status & CERT_TRUST_IS_NOT_TIME_VALID)
|
136
|
+
{
|
137
|
+
return IceSSL::ICE_ENUM(TrustError, InvalidTime);
|
138
|
+
}
|
139
|
+
return IceSSL::ICE_ENUM(TrustError, UnknownTrustFailure);
|
140
|
+
}
|
141
|
+
|
50
142
|
string
|
51
143
|
trustStatusToString(DWORD status)
|
52
144
|
{
|
@@ -674,21 +766,38 @@ SChannel::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal:
|
|
674
766
|
|
675
767
|
string trustError;
|
676
768
|
PCCERT_CHAIN_CONTEXT certChain;
|
677
|
-
|
678
|
-
|
769
|
+
DWORD dwFlags = 0;
|
770
|
+
int revocationCheck = _engine->getRevocationCheck();
|
771
|
+
if(revocationCheck > 0)
|
772
|
+
{
|
773
|
+
if(_engine->getRevocationCheckCacheOnly())
|
774
|
+
{
|
775
|
+
// Disable network I/O for revocation checks.
|
776
|
+
dwFlags = CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY | CERT_CHAIN_DISABLE_AIA;
|
777
|
+
}
|
778
|
+
|
779
|
+
dwFlags |= (revocationCheck == 1 ?
|
780
|
+
CERT_CHAIN_REVOCATION_CHECK_END_CERT :
|
781
|
+
CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT);
|
782
|
+
}
|
783
|
+
|
784
|
+
if(!CertGetCertificateChain(_engine->chainEngine(), cert, 0, cert->hCertStore, &chainP, dwFlags, 0, &certChain))
|
679
785
|
{
|
680
786
|
CertFreeCertificateContext(cert);
|
681
787
|
trustError = IceUtilInternal::lastErrorToString();
|
788
|
+
_trustError = IceSSL::ICE_ENUM(TrustError, UnknownTrustFailure);
|
682
789
|
}
|
683
790
|
else
|
684
791
|
{
|
685
792
|
if(certChain->TrustStatus.dwErrorStatus != CERT_TRUST_NO_ERROR)
|
686
793
|
{
|
687
794
|
trustError = trustStatusToString(certChain->TrustStatus.dwErrorStatus);
|
795
|
+
_trustError = trustStatusToTrustError(certChain->TrustStatus.dwErrorStatus);
|
688
796
|
}
|
689
797
|
else
|
690
798
|
{
|
691
799
|
_verified = true;
|
800
|
+
_trustError = IceSSL::ICE_ENUM(TrustError, NoError);
|
692
801
|
}
|
693
802
|
|
694
803
|
CERT_SIMPLE_CHAIN* simpleChain = certChain->rgpChain[0];
|
@@ -753,7 +862,10 @@ SChannel::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal:
|
|
753
862
|
}
|
754
863
|
catch(const Ice::SecurityException&)
|
755
864
|
{
|
865
|
+
_trustError = IceSSL::ICE_ENUM(TrustError, HostNameMismatch);
|
756
866
|
_verified = false;
|
867
|
+
ICE_DYNAMIC_CAST(ExtendedConnectionInfo, info)->errorCode = IceSSL::ICE_ENUM(TrustError, HostNameMismatch);
|
868
|
+
info->verified = false;
|
757
869
|
if(_engine->getVerifyPeer() > 0)
|
758
870
|
{
|
759
871
|
throw;
|
@@ -1001,13 +1113,15 @@ SChannel::TransceiverI::toDetailedString() const
|
|
1001
1113
|
Ice::ConnectionInfoPtr
|
1002
1114
|
SChannel::TransceiverI::getInfo() const
|
1003
1115
|
{
|
1004
|
-
|
1116
|
+
ExtendedConnectionInfoPtr info = ICE_MAKE_SHARED(ExtendedConnectionInfo);
|
1005
1117
|
info->underlying = _delegate->getInfo();
|
1006
1118
|
info->incoming = _incoming;
|
1007
1119
|
info->adapterName = _adapterName;
|
1008
1120
|
info->cipher = _cipher;
|
1009
1121
|
info->certs = _certs;
|
1010
1122
|
info->verified = _verified;
|
1123
|
+
info->errorCode = _trustError;
|
1124
|
+
info->host = _incoming ? "" : _host;
|
1011
1125
|
return info;
|
1012
1126
|
}
|
1013
1127
|
|
@@ -27,7 +27,9 @@ IceSSL::SSLEngine::SSLEngine(const Ice::CommunicatorPtr& communicator) :
|
|
27
27
|
_initialized(false),
|
28
28
|
_communicator(communicator),
|
29
29
|
_logger(communicator->getLogger()),
|
30
|
-
_trustManager(new TrustManager(communicator))
|
30
|
+
_trustManager(new TrustManager(communicator)),
|
31
|
+
_revocationCheckCacheOnly(false),
|
32
|
+
_revocationCheck(0)
|
31
33
|
{
|
32
34
|
}
|
33
35
|
|
@@ -135,6 +137,11 @@ IceSSL::SSLEngine::initialize()
|
|
135
137
|
|
136
138
|
_securityTraceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security");
|
137
139
|
_securityTraceCategory = "Security";
|
140
|
+
|
141
|
+
const_cast<bool&>(_revocationCheckCacheOnly) =
|
142
|
+
properties->getPropertyAsIntWithDefault("IceSSL.RevocationCheckCacheOnly", 1) > 0;
|
143
|
+
const_cast<int&>(_revocationCheck) =
|
144
|
+
properties->getPropertyAsIntWithDefault("IceSSL.RevocationCheck", 0);
|
138
145
|
}
|
139
146
|
|
140
147
|
void
|
@@ -292,3 +299,15 @@ IceSSL::SSLEngine::securityTraceCategory() const
|
|
292
299
|
{
|
293
300
|
return _securityTraceCategory;
|
294
301
|
}
|
302
|
+
|
303
|
+
bool
|
304
|
+
IceSSL::SSLEngine::getRevocationCheckCacheOnly() const
|
305
|
+
{
|
306
|
+
return _revocationCheckCacheOnly;
|
307
|
+
}
|
308
|
+
|
309
|
+
int
|
310
|
+
IceSSL::SSLEngine::getRevocationCheck() const
|
311
|
+
{
|
312
|
+
return _revocationCheck;
|
313
|
+
}
|
@@ -66,6 +66,8 @@ public:
|
|
66
66
|
bool getServerNameIndication() const;
|
67
67
|
int getVerifyPeer() const;
|
68
68
|
int securityTraceLevel() const;
|
69
|
+
bool getRevocationCheckCacheOnly() const;
|
70
|
+
int getRevocationCheck() const;
|
69
71
|
std::string securityTraceCategory() const;
|
70
72
|
|
71
73
|
protected:
|
@@ -89,6 +91,8 @@ private:
|
|
89
91
|
int _verifyPeer;
|
90
92
|
int _securityTraceLevel;
|
91
93
|
std::string _securityTraceCategory;
|
94
|
+
const bool _revocationCheckCacheOnly;
|
95
|
+
const int _revocationCheck;
|
92
96
|
};
|
93
97
|
|
94
98
|
}
|