CSDNCurrent en:Client Verification

Aus Cryptshare Documentation
Wechseln zu:Navigation, Suche

Client Verification

If the Verification mode is set to Client Verification, any sender email address can be used to perform a transfer operation. With Client Verification mode, the Client instance can use any sender email address to perform its operations as long as `Client.RequestClientVerification()` has been called once for each sender email address.

Please Note
Using Client Verification increases the risk of abuse, since anyone with access to the verified Client instance can perform Cryptshare transfers using any sender email address. It is therefore recommended that Client Verification mode only be used if Sender Verification mode does not meet your requirements.

To verify your Client instance, first make sure that the Verification mode configured on the Cryptshare Server is set to Client Verification. You can then access the `ClientId` property on the Client instance. You then have to register this Client ID on the Cryptshare Server administration page:

33227489.png

After having added the Client ID in the administration interface, you need to request a client verification for the given sender email address by simply calling `Client.RequestClientVerification()`.

Example: Performing a Client Verification

using Cryptshare.API;
using System;

namespace CryptshareClientVerifier
{
	class Program
	{
		private const string Sender = "john.doe@example.com";
		private const string ServerUrl = "https://cryptshare.example.com";
		private const string ClientStorePath = @"C:\temp";

		static void Main(string[] args)
		{
			try
			{
				var connection = new CryptshareConnection(new WebServiceUri(ServerUrl));
				var client = new Client(Sender, connection, ClientStorePath);
				Console.WriteLine("Checking whether the client is verified...");
				var result = client.CheckVerification();
				if (result.Verified)
				{
					Console.WriteLine("The client is verified; nothing to do.");
					return;
				}
				if (result.VerificationMode == VerificationMode.Sender)
				{
					Console.WriteLine("Verification mode is set to 'Sender', please set it to 'Client' and add the following Client ID: {0}.",
						client.ClientId);
					return;
				}
				try
				{
					client.RequestClientVerification();
					Console.WriteLine("The client verification has been requested. Please rerun the program and check whether your client is verified.");
				}
				catch (CryptshareServerException)
				{
					Console.WriteLine("The verification mode is set to 'Client', but your Client ID is not whitelisted. " +
						"Please add your Client ID '{0}' to the list of allowed clients.", client.ClientId);
				}
			}
			catch (Exception e)
			{
				Console.WriteLine(e);
			}
			finally
			{
				Console.ReadKey();
			}
		}
	}
}

For more information regarding the verification procedure, please refer to the dedicated article in the Cryptshare Server manual.