ICE 3.4.2
[php5-ice-freebsdport.git] / cs / src / IceSSL / Plugin.cs
blobd948f28a93996d248b038d28a2348da330316889
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
10 namespace IceSSL
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);
28 /// <summary>
29 /// A password callback is an alternate way of supplying the plug-in with
30 /// passwords; this avoids using plain text configuration properties.
31 /// </summary>
32 public interface PasswordCallback
34 /// <summary>
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>
39 /// </summary>
40 SecureString getPassword(string file);
42 /// <summary>
43 /// Obtain a password for a certificate being imported via an IceSSL.ImportCert
44 /// property. Return null if no password is necessary.
45 /// </summary>
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);
51 /// <summary>
52 /// Interface that allows applications to interact with the IceSSL plug-in.
53 /// </summary>
54 abstract public class Plugin : Ice.Plugin
56 abstract public void initialize();
58 /// <summary>
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.
66 /// </summary>
67 /// <param name="certs">The certificates to use for SSL connections.</param>
68 abstract public void setCertificates(X509Certificate2Collection certs);
70 /// <summary>
71 /// Establish the certificate verifier object. This must be
72 /// done before any connections are established.
73 /// </summary>
74 /// <param name="verifier">The certificate verifier.</param>
75 abstract public void setCertificateVerifier(CertificateVerifier verifier);
77 /// <summary>
78 /// Obtain the certificate verifier object.
79 /// </summary>
80 /// <returns>The certificate verifier (null if not set).</returns>
81 abstract public CertificateVerifier getCertificateVerifier();
83 /// <summary>
84 /// Establish the password callback object. This must be
85 /// done before the plug-in is initialized.
86 /// </summary>
87 /// <param name="callback">The password callback.</param>
88 abstract public void setPasswordCallback(PasswordCallback callback);
90 /// <summary>
91 /// Returns the password callback.
92 /// </summary>
93 /// <returns>The password callback (null if not set).</returns>
94 abstract public PasswordCallback getPasswordCallback();
96 /// <summary>
97 /// This method is for internal use.
98 /// </summary>
99 abstract public void destroy();