1 // **********************************************************************
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
8 // **********************************************************************
12 using System
.Security
;
13 using System
.Security
.Cryptography
.X509Certificates
;
16 // An application can customize the certificate verification process
17 // by implementing the CertificateVerifier interface.
19 public interface CertificateVerifier
22 // Return true to allow a connection using the provided certificate
23 // information, or false to reject the connection.
25 bool verify(NativeConnectionInfo info
);
29 /// A password callback is an alternate way of supplying the plug-in with
30 /// passwords; this avoids using plain text configuration properties.
32 public interface PasswordCallback
35 /// Obtain the password necessary to access the private key associated with
36 /// the certificate in the given file.
37 /// <param name="file">The certificate file name.</param>
38 /// <returns>The password for the key or null, if no password is necessary.</returns>
40 SecureString
getPassword(string file
);
43 /// Obtain a password for a certificate being imported via an IceSSL.ImportCert
44 /// property. Return null if no password is necessary.
46 /// <param name="file">The certificate file name.</param>
47 /// <returns>The password for the key or null, if no password is necessary.</returns>
48 SecureString
getImportPassword(string file
);
52 /// Interface that allows applications to interact with the IceSSL plug-in.
54 abstract public class Plugin
: Ice
.Plugin
56 abstract public void initialize();
59 /// Specify the certificates to use for SSL connections. This
60 /// must be done before the plug-in is initialized; therefore,
61 /// the application must define the property Ice.InitPlugins=0,
62 /// set the certificates, and finally invoke initializePlugins
63 /// on the PluginManager.
64 /// When the application supplies its own certificates, the
65 /// plug-in skips its normal property-based configuration.
67 /// <param name="certs">The certificates to use for SSL connections.</param>
68 abstract public void setCertificates(X509Certificate2Collection certs
);
71 /// Establish the certificate verifier object. This must be
72 /// done before any connections are established.
74 /// <param name="verifier">The certificate verifier.</param>
75 abstract public void setCertificateVerifier(CertificateVerifier verifier
);
78 /// Obtain the certificate verifier object.
80 /// <returns>The certificate verifier (null if not set).</returns>
81 abstract public CertificateVerifier
getCertificateVerifier();
84 /// Establish the password callback object. This must be
85 /// done before the plug-in is initialized.
87 /// <param name="callback">The password callback.</param>
88 abstract public void setPasswordCallback(PasswordCallback callback
);
91 /// Returns the password callback.
93 /// <returns>The password callback (null if not set).</returns>
94 abstract public PasswordCallback
getPasswordCallback();
97 /// This method is for internal use.
99 abstract public void destroy();