CSJCurrent en:Sender Verification

Aus Cryptshare Documentation
Wechseln zu:Navigation, Suche



With Sender Verification mode, a verification has to be performed for each sender email address that is used. This makes sure that the sender address that is being used for a transfer through the API is valid and authorized for use by its owner. That's important, because the Cryptshare Policy set up on the server grants usage permissions and settings based on the email addresses used for a transfer. To verify a specific sender email address, you need to send a verification request for that email address to the Cryptshare Server. The Cryptshare Server will then send a verification email containing a verification code to the specified sender email address. This verification code will then need to be stored in the Client's verification store for the corresponding sender email address. Once this verification process is complete, the Client will then subsequently read the verification code for the sender email address from its verification store and include that data in each request it sends to the Cryptshare Server. The Cryptshare Server then checks the email address / verification code combination against its own database entry, to make sure the sender email address is indeed verified, before performing any requested operations.

You can find information regarding the maximum number of verification codes to be entered here.


Example: Performing a Sender Verification

// First create the Client instance
// Create a WebServiceUri for your Cryptshare Server 
WebServiceUri serviceUri = new WebServiceUri("https://cryptshare.server.com");
 
// Create a CryptshareConnection instance for your WebServiceUri
CryptshareConnection connection = new CryptshareConnection(serviceUri);
 
// Create the Client instance with the sender's email address, 
// the CryptshareConnection, and the path to the verification store.
Client client = new Client("sender_email@server.com", connection, Paths.get("C:\\\\temp\\\\client.store");

// now you can call the checkVerification() method, to first check the
// current verification status of the specified sender email address
CheckVerificationResult result = client.checkVerification();

if (result.getVerificationMode() == VerificationMode.SENDER) { 
	// Verification Mode is indeed set to Sender Verification
	if (!result.isUserVerified()) {
		// Sender email address is NOT verified, so request a new verification code
		client.requestSenderVerification();
	
		// Cryptshare Server will now have sent an email containing the new
		// verification code to the email address "sender_email@server.com".
		// So now you could, for instance, prompt the user of your application
		// to enter that code on the command line, or if your application
		// has access to the user's emails, you could automatically parse the
		// email for the verification code.
		// Let's ask the user to enter the code:
		System.out.println("Please type in the verification code:");
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String vericode = reader.readLine();
        reader.close();

		// now tell the client to store the verification code in the 
		// verification store
        client.confirmSenderVerification(vericode.trim());
	}
}