/// <summary> /// Removes all public keys from the KeyRing /// and then saves the new empty ring to the PublicKeyRing file. /// </summary> public static void PublicKeyRingClearAll() { lock (Instance.m_keyRing_Lock) { Instance.m_keyRing = NodePublicKeyRing.BuildWith(); KeyRingSave(); } }
public static NodePublicKeyRing BuildWith() { //build fields Dictionary<FieldIdentifier, FieldBase> mutableFields = new Dictionary<FieldIdentifier, FieldBase>(); //build children KeyedNodeCollection<NodeBase> mutableChildren = new KeyedNodeCollection<NodeBase>(); //build node NodePublicKeyRing Builder = new NodePublicKeyRing( new ReadOnlyDictionary<FieldIdentifier, FieldBase>(mutableFields), new ReadOnlyCollection<NodeBase>(mutableChildren)); return Builder; }
public static NodePublicKeyRing BuildWith() { //build fields Dictionary <FieldIdentifier, FieldBase> mutableFields = new Dictionary <FieldIdentifier, FieldBase>(); //build children KeyedNodeCollection <NodeBase> mutableChildren = new KeyedNodeCollection <NodeBase>(); //build node NodePublicKeyRing Builder = new NodePublicKeyRing( new ReadOnlyDictionary <FieldIdentifier, FieldBase>(mutableFields), new ReadOnlyCollection <NodeBase>(mutableChildren)); return(Builder); }
private static void KeyRingInit() { lock (Instance.m_keyRing_Lock) { if (Instance.m_keyRing == null) { if (File.Exists(PUBLIC_KEY_RING_FILE_NAME)) { //if we have an error, then let it throw the exception TextReader tr = new StreamReader(PUBLIC_KEY_RING_FILE_NAME); string xml = tr.ReadToEnd(); tr.Close(); NodePublicKeyRing newKeyRing = (NodePublicKeyRing)NodeBase.NodeFromXML(xml, null); Instance.m_keyRing = newKeyRing; } else { Instance.m_keyRing = NodePublicKeyRing.BuildWith(); } } } }