Move toBytes() into SASLMechanism

as it's a often needed transformation in the SASL world.