Exemplo n.º 1
0
        public string Encrypt()
        {
            CryptographyHelper cryptographyHelper = new CryptographyHelper();
            X509Certificate2   certificate        = cryptographyHelper.GetX509Certificate("CN=Auth-Token");

            return(cryptographyHelper.Encrypt(certificate, this.ToString()));
        }
Exemplo n.º 2
0
        public static Token Decrypt(string encryptedToken)
        {
            CryptographyHelper cryptographyHelper = new CryptographyHelper();
            X509Certificate2   certificate        = cryptographyHelper.GetX509Certificate("CN=Auth-Token");
            string             decrypted          = cryptographyHelper.Decrypt(certificate, encryptedToken);

            //Splitting it to dictionary
            Dictionary <string, string> dictionary = decrypted.ToDictionary();

            return(new Token(dictionary["User"], dictionary["ClientAddress"], dictionary["ApplicationKey"], dictionary["AccessFeatures"]));
        }