Esempio n. 1
0
        private static string GeneratePassword(Types.EncryptionType encryptionType, PegaUser user)
        {
            switch (encryptionType)
            {
            case Types.EncryptionType.ApiKey_Public: return($"QZ{string.Join("d", user.Username.Reverse())}_V638uhWV");

            case Types.EncryptionType.ApiKey_Private: return($"TZ{user.Username}V638{string.Join("b", user.CreatedDate.ToShortDateString().Replace("/", "").Reverse())}_$WV");
            }

            return(string.Empty);
        }
Esempio n. 2
0
        private static string _vector = "xxx"; // Random

        private static void SetProperSaltAndVector(Types.EncryptionType encryptionType)
        {
            switch (encryptionType)
            {
            case Types.EncryptionType.ApiKey_Public:
            case Types.EncryptionType.ApiKey_Private:
                _salt   = "xxx+";
                _vector = "xxx";
                return;
            }
        }
Esempio n. 3
0
        public static string Decrypt(string value, Types.EncryptionType encryptionType, PegaUser user)
        {
            SetProperSaltAndVector(encryptionType);

            switch (encryptionType)
            {
            case Types.EncryptionType.ApiKey_Public: return(Decrypt(value, GeneratePassword(encryptionType, user)));

            case Types.EncryptionType.ApiKey_Private: return(Decrypt(value, GeneratePassword(encryptionType, user)));
            }

            return(string.Empty);
        }