예제 #1
0
파일: FormInfo.cs 프로젝트: modulexcite/CEX
 public void SetInfo(PackageInfo Info)
 {
     lstInfo.Items.Clear();
     lstInfo.Items.Add("Creation and Origin");
     lstInfo.Items.Add("Created: " + Info.Created.ToString());
     lstInfo.Items.Add("Expires: " + Info.Expiration.ToString());
     lstInfo.Items.Add("Origin:" + Info.Origin.ToString());
     lstInfo.Items.Add("");
     lstInfo.Items.Add("Key Settings");
     lstInfo.Items.Add("Sub Keys:" + Info.SubKeyCount);
     lstInfo.Items.Add("Cipher: " + MemberToString((SymmetricEngines)Info.Description.CipherType));
     lstInfo.Items.Add("HMAC:" + (Info.Description.MacSize > 0 ? MemberToString((Digests)Info.Description.MacEngine) : "None"));
     if (!string.IsNullOrEmpty(Info.Tag))
         lstInfo.Items.Add("Description: " + Info.Tag);
     lstInfo.Items.Add("");
     lstInfo.Items.Add("Key Policies");
     foreach (var item in Info.Policies)
     {
         if (item != KeyPolicies.None)
             lstInfo.Items.Add(MemberToString((KeyPolicies)item));
     }
 }
예제 #2
0
        /// <summary>
        /// Get information about the key file in the form of an <see cref="PackageInfo"/> structure
        /// </summary>
        /// 
        /// <returns>A <see cref="PackageInfo"/> structure</returns>
        /// 
        /// <exception cref="CryptoProcessingException">Thrown if the user has insufficient access rights to access this PackageKey</exception>
        public PackageInfo KeyInfo()
        {
            if (AccessScope.Equals(KeyScope.NoAccess))
                throw new CryptoProcessingException("PackageFactory:KeyInfo", "You do not have permission to access this key!", new UnauthorizedAccessException());

            PackageInfo info = new PackageInfo(_keyPackage);

            // return limited data
            if (PackageKey.KeyHasPolicy(KeyPolicy, (long)KeyPolicies.NoNarrative))
            {
                info.Origin = Guid.Empty;
                info.Policies.Clear();
            }

            return info;
        }