Text this: An algebraic framework for reasoning about security