Algorithm 3. Serialization of cryptograph contexts.