Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Keyczar"/> class.
        /// </summary>
        /// <param name="keySet">The key set.</param>
        protected Keyczar(IKeySet keySet)
        {
            var metadata = keySet.Metadata;

            var versions = metadata
                           .Versions
                           .Select(v =>
            {
                var key = keySet.GetKey(v.VersionNumber);
                return(Tuple.Create(key.GetKeyHash(), v, key));
            })
                           .ToList();

            _primaryVersion = metadata.Versions.SingleOrDefault(it => it.Status == KeyStatus.Primary);

            _versions = versions.ToDictionary(k => k.Item2.VersionNumber, v => v.Item3);

            _hashedKeys         = HashKeys(versions);
            _hashedFallbackKeys = HashedFallbackKeys(versions);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyVersion"/> class.
 /// </summary>
 /// <param name="keyVersion">The key version.</param>
 public OfficialKeyVersion(KeyVersion keyVersion)
 {
     VersionNumber = keyVersion.VersionNumber;
     Exportable    = keyVersion.Exportable;
     Status        = keyVersion.Status;
 }