/// <summary> /// Lookup/create a key set for a scheme. /// </summary> /// <param name="scheme"></param> /// <returns></returns> private IKeySet NewKeysetFor(KeyScheme scheme) { if (scheme.IsDual()) return NewKeysetFor((DualKeyScheme)scheme); else return NewKeysetFor((SingleKeyScheme)scheme); }
private void Add(KeyScheme scheme, IKeySet keys) { if (!keys.IsEmpty) NewKeysetFor(scheme).Add(keys); }
/// <summary> /// Get the key set for a given scheme. This set should not be modified. /// </summary> /// <param name="scheme">The scheme.</param> /// <returns>The key set for the scheme. Will be empty if no keys are /// defined for the scheme.</returns> private IKeySet KeysetFor(KeyScheme scheme) { IKeySet keys; if (!keySets.TryGetValue(scheme, out keys)) return scheme.IsDual() ? (IKeySet)EmptyDualKeyset : (IKeySet)EmptySingleKeyset; else return keys; }
/// <summary> /// Shortcut to generate the public (prime) key for a given scheme. /// </summary> /// <param name="scheme"></param> /// <returns></returns> public Key PublicKeyFor(KeyScheme scheme) { return scheme.PublicKeyFor(this); }