5 // Martin Baulig <martin.baulig@xamarin.com>
7 // Copyright (c) 2015 Xamarin, Inc.
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 namespace Mono.Security.Interface
30 public sealed class MonoTlsSettings
32 public MonoRemoteCertificateValidationCallback ServerCertificateValidationCallback {
36 public MonoLocalCertificateSelectionCallback ClientCertificateSelectionCallback {
40 public bool CheckCertificateName {
41 get { return checkCertName; }
42 set { checkCertName = value; }
45 public bool CheckCertificateRevocationStatus {
46 get { return checkCertRevocationStatus; }
47 set { checkCertRevocationStatus = value; }
50 public bool UseServicePointManagerCallback {
51 get { return useServicePointManagerCallback; }
52 set { useServicePointManagerCallback = value; }
55 public bool SkipSystemValidators {
56 get { return skipSystemValidators; }
57 set { skipSystemValidators = value; }
60 public bool CallbackNeedsCertificateChain {
61 get { return callbackNeedsChain; }
62 set { callbackNeedsChain = value; }
65 public object UserSettings {
70 bool checkCertName = true;
71 bool checkCertRevocationStatus = false;
72 bool useServicePointManagerCallback = false;
73 bool skipSystemValidators = false;
74 bool callbackNeedsChain = true;
75 ICertificateValidator certificateValidator;
80 * Private APIs - do not use!
82 * This is only public to avoid making our internals visible to System.dll.
86 [Obsolete ("Do not use outside System.dll!")]
87 public ICertificateValidator CertificateValidator {
88 get { return certificateValidator; }
89 set { certificateValidator = value; }
92 [Obsolete ("Do not use outside System.dll!")]
93 public MonoTlsSettings CloneWithValidator (ICertificateValidator validator)
96 this.certificateValidator = validator;
100 var copy = new MonoTlsSettings ();
101 copy.ServerCertificateValidationCallback = ServerCertificateValidationCallback;
102 copy.ClientCertificateSelectionCallback = ClientCertificateSelectionCallback;
103 copy.checkCertName = checkCertName;
104 copy.checkCertRevocationStatus = checkCertRevocationStatus;
105 copy.UseServicePointManagerCallback = useServicePointManagerCallback;
106 copy.skipSystemValidators = skipSystemValidators;
107 copy.callbackNeedsChain = callbackNeedsChain;
108 copy.UserSettings = UserSettings;
109 copy.certificateValidator = validator;