public static string EncryptPrincipal <P>(P prin, short proj) where P : IData { var cnt = new JsonContent(true, 4096); try { cnt.PutToken(prin, proj); // use the special putting method to append time stamp var buf = cnt.Buffer; int count = cnt.Count; Encrypt(buf, count, Application.CryptoKey); return(BytesToHex(buf, count)); } finally { cnt.Clear(); } }