public virtual void Validate(object armorToken) { Execute(); if (!ArmorTokenValidationStepResult.IsValid) { return; } next.Validate(ArmorTokenValidationStepResult.Output); ArmorTokenValidationStepResult = next.ArmorTokenValidationStepResult; }
public void Execute() { var validate = new ClaimsArmorTokenValidationStep(new EmptyEncryptedArmorTokenValidationStep(), new UserIdClaimValidatorFactory(userId), new TimeStampClaimValidatorFactory(timeout)); var deserialise = new SerialisedArmorTokenValidationStep(new ArmorTokenDeserialisor(), validate); var decrypt = new EncryptedArmorTokenValidationStep(deserialise, new RijndaelDecryptionMechanismFactory(encryptionKey)); var hash = new HashedArmorTokenValidationStep(decrypt, new HashedArmorTokenParser(HashingMode.HMACSHA512), new HMACSHA512ArmorTokenHasherFactory(hashingKey)); var armorTokenValidator = new ArmorTokenValidator(Convert.FromBase64String(secureArmorToken), hash); armorTokenValidator.Execute(); ArmorTokenValidationStepResult = armorTokenValidator.ArmorTokenValidationStepResult; }
public override void Execute() { hashedArmorTokenParser.Execute(); var armorTokenHasher = armorTokenHasherFactory.CreateArmorTokenHasher(hashedArmorTokenParser.ParsedArmorToken.ArmorToken); armorTokenHasher.Execute(); var isValid = armorTokenHasher.Hash.Equals(Convert.ToBase64String(hashedArmorTokenParser.ParsedArmorToken.Hash)); ArmorTokenValidationStepResult = new ArmorTokenValidationStepResult { IsValid = isValid, Message = isValid ? "Untampered" : "Tampered", Output = hashedArmorTokenParser.ParsedArmorToken.ArmorToken }; }
public override void Execute() { try { encryptionMechanism.Execute(); ArmorTokenValidationStepResult = new ArmorTokenValidationStepResult { IsValid = true, Message = "Untampered", Output = encryptionMechanism.Output }; } catch (CryptographicException) { ArmorTokenValidationStepResult = new ArmorTokenValidationStepResult { IsValid = false, Message = "Tampered" }; } }
public void Execute() { first.Validate(armorToken); ArmorTokenValidationStepResult = first.ArmorTokenValidationStepResult; }