summary refs log tree commit diff
path: root/Crypto/src/crypto/tls/LegacyTlsAuthentication.cs
blob: 395f9420862fcaf289658b606bf3292ea9be76a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;

namespace Org.BouncyCastle.Crypto.Tls
{
	/// <summary>
	/// A temporary class to wrap old CertificateVerifyer stuff for new TlsAuthentication.
	/// </summary>
	[Obsolete]
	public class LegacyTlsAuthentication
		: TlsAuthentication
	{
		protected ICertificateVerifyer verifyer;

		public LegacyTlsAuthentication(ICertificateVerifyer verifyer)
		{
			this.verifyer = verifyer;
		}

		public virtual void NotifyServerCertificate(Certificate serverCertificate)
		{
			if (!this.verifyer.IsValid(serverCertificate.GetCerts()))
				throw new TlsFatalAlert(AlertDescription.user_canceled);
		}

		public virtual TlsCredentials GetClientCredentials(CertificateRequest certificateRequest)
		{
			return null;
		}
	}
}