/// <summary> /// Construct an instance from the specified tagged JSONReader stream. /// </summary> public static void Deserialize(JSONReader JSONReader, out JSONObject Out) { JSONReader.StartObject (); if (JSONReader.EOR) { Out = null; return; } string token = JSONReader.ReadToken (); Out = null; switch (token) { case "JoseWebSignature" : { var Result = new JoseWebSignature (); Result.Deserialize (JSONReader); Out = Result; break; } case "JoseWebEncryption" : { var Result = new JoseWebEncryption (); Result.Deserialize (JSONReader); Out = Result; break; } case "Signed" : { var Result = new Signed (); Result.Deserialize (JSONReader); Out = Result; break; } case "Encrypted" : { var Result = new Encrypted (); Result.Deserialize (JSONReader); Out = Result; break; } case "KeyData" : { var Result = new KeyData (); Result.Deserialize (JSONReader); Out = Result; break; } case "Header" : { var Result = new Header (); Result.Deserialize (JSONReader); Out = Result; break; } case "Key" : { var Result = new Key (); Result.Deserialize (JSONReader); Out = Result; break; } case "Recipient" : { var Result = new Recipient (); Result.Deserialize (JSONReader); Out = Result; break; } case "PublicKeyRSA" : { var Result = new PublicKeyRSA (); Result.Deserialize (JSONReader); Out = Result; break; } case "PrivateKeyRSA" : { var Result = new PrivateKeyRSA (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader"></param> public static new PublicKeyRSA FromTagged (JSONReader JSONReader) { PublicKeyRSA Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "PublicKeyRSA" : { var Result = new PublicKeyRSA (); Result.Deserialize (JSONReader); Out = Result; break; } case "PrivateKeyRSA" : { var Result = new PrivateKeyRSA (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }