CSDNCurrent de:QUICK Zugang aktivieren
Wenn Sie einen QUICK-Transfer durchführen möchten, ist es wichtig sicherzustellen, dass keine QUICK-Aktivierung notwendig ist. Eine QUICK-Aktivierung kann möglicherweise dann notwendig sein, wenn der Benutzer bereits in der Vergangenheit QUICK genutzt hat und bspw. aufgrund gelöschter Cookies keinen Zugriff mehr auf die QUICK-Zugangsdaten hat, oder wenn der Benutzer QUICK auf einem neuen Gerät nutzen möchte. Der QUICK-Zugang kann über zwei Wege aktiviert werden:
- Anforderung eines QUICK-Aktivierungscodes durch den Cryptshare Server-Administrator.
- eigenständige Generierung eines QUICK-Aktivierungscodes über ein Gerät, welcher einen gültigen QUICK-Zugang besitzt.
Der angeforderte Code kann dann dem Cryptshare Server übermittelt werden, welcher wiederum den bestehenden QUICK-Zugang auf dem aktuellen Gerät aktiviert. Unser Ziel ist es nun, den auf einem anderen Client genutzten QUICK-Zugang auf dem aktuellen Client zu aktivieren. Im folgenden Beispiel werden wir ein kleines Programm schreiben, welches Ihnen die Aktivierung von QUICK anbietet, sofern eine QUICK-Aktivierung notwendig ist. Um ein Szenario nachzustellen, welches die Aktivierung von QUICK erfordert, müssen Sie lediglich:
- über einen anderen Client (bspw. Browser oder Outlook) unter Verwendung derselben E-Mail-Addresse einen QUICK-Transfer durchführen
- die evtl. auf dem aktuellen Client vorhandene `client.store` Datei löschen
- eine Absenderverifizierung mithilfe des Artikels "Schnellstartanleitung" auf dem aktuellen Client durchführen
Somit stellen Sie sicher, dass auf dem Client, auf welchem das Programm läuft, eine QUICK-Aktivierung notwendig ist.
Ausklappen, um Quellcode einzusehen... Expand source
using Cryptshare.API;
using System;
using System.Globalization;
namespace QuickTransfer
{
class Program
{
private static Client client;
private static CheckVerificationResult checkVerificationResult;
static void Main(string[] args)
{
try
{
client = new Client(
"john.doe@example.com",
new CryptshareConnection(new WebServiceUri("https://cryptshare.example.com")),
@"C:\Temp"
);
checkVerificationResult = client.CheckVerification();
// Do not proceed if the user is not already verified.
if (!checkVerificationResult.Verified)
{
throw new Exception("Cannot perform a QUICK activation if the client is not verified.");
}
// If the user already has a personal key on this server, display options to recover QUICK access.
if (checkVerificationResult.ActivationRequired)
{
DisplayActivationMenu();
Console.WriteLine("Please enter the QUICK activation code below and press [Enter]:");
client.ApplyQuickActivationCode(Console.ReadLine().Trim());
}
else
{
string inlineText = checkVerificationResult.QuickEnabled
? "is enabled for QUICK"
: "has not used QUICK before";
Console.WriteLine($"The user {inlineText}; no action required.");
}
}
catch (Exception e)
{
Console.Error.WriteLine("An error has occurred: " + e);
}
finally
{
Console.WriteLine("Press any key to terminate the program.");
Console.ReadKey();
}
}
private static void DisplayActivationMenu()
{
Console.WriteLine("A QUICK activation is required; please choose an option below:");
Console.WriteLine("(1) Request QUICK activation code via the Cryptshare Server Administrator");
Console.WriteLine("(2) Enter a QUICK activation code generated from another QUICK-enabled client");
int choice;
bool invalidInput;
do
{
invalidInput = false;
int.TryParse(Console.ReadLine(), out choice);
switch (choice)
{
case 1:
PerformActivationViaAdministrator();
break;
case 2:
PerformActivationViaOtherClient();
break;
default:
Console.WriteLine("Invalid choice; please repeat your input:");
invalidInput = true;
break;
}
} while (invalidInput);
}
private static void PerformActivationViaAdministrator()
{
checkVerificationResult = client.CheckVerification();
// We choose to display the English QUICK recovery instructions. The texts can be freely defined on the
// Cryptshare Administration Interface via "QUICK" > "Recovery Settings" > "{Your language}".
Console.WriteLine(checkVerificationResult.AdministratorActivationContactDetails[new CultureInfo("en")]);
}
private static void PerformActivationViaOtherClient()
{
checkVerificationResult = client.CheckVerification();
if (checkVerificationResult.QuickEnabledClients.Count > 0)
{
Console.WriteLine("The server has reported that QUICK has been last used on the following clients. Please generate a QUICK activation code using one of these clients:");
foreach (var clientInformation in checkVerificationResult.QuickEnabledClients)
{
Console.WriteLine("Name: " + clientInformation.Name);
Console.WriteLine("Platform: " + clientInformation.Platform);
Console.WriteLine("Last use: " + clientInformation.LastUse);
Console.WriteLine("Last IP address: " + clientInformation.LastIpAddress + "\n");
}
}
else
{
Console.WriteLine("No other QUICK-enabled client has been reported by the server. Please choose option (1) to obtain a QUICK activation code via the Cryptshare Server Administrator.");
}
}
}
}
Die Funktionalität des resultierenden Programms wird im unten stehenden Video demonstriert:
Your browser does not support the HTML5 video element