示例#1
0
文件: Encryption.cs 项目: zzy092/npoi
        public CT_PasswordKeyEncryptor AddNewEncryptedPasswordKey()
        {
            CT_PasswordKeyEncryptor t = new CT_PasswordKeyEncryptor();

            this.itemField = t;
            return(t);
        }
示例#2
0
文件: Encryption.cs 项目: zzy092/npoi
        public static CT_KeyEncryptor Parse(XmlNode node, XmlNamespaceManager nameSpaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_KeyEncryptor ctObj = new CT_KeyEncryptor();

            if (node.Attributes["uri"] != null)
            {
                ctObj.uriFieldSpecified = true;
                ctObj.uriField          = XmlHelper.GetEnumValueFromString <CT_KeyEncryptorUri>(node.Attributes["uri"].Value);
            }
            foreach (XmlNode child in node.ChildNodes)
            {
                if (ctObj.uriField == CT_KeyEncryptorUri.httpschemasmicrosoftcomoffice2006keyEncryptorcertificate)
                {
                    ctObj.itemField = CT_CertificateKeyEncryptor.Parse(child, nameSpaceManager);
                }
                else
                {
                    ctObj.itemField = CT_PasswordKeyEncryptor.Parse(child, nameSpaceManager);
                }
            }
            return(ctObj);
        }
示例#3
0
        public static CT_PasswordKeyEncryptor Parse(XmlNode node, XmlNamespaceManager nameSpaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_PasswordKeyEncryptor ctObj = new CT_PasswordKeyEncryptor();

            ctObj.spinCount       = XmlHelper.ReadUInt(node.Attributes["spinCount"]);
            ctObj.saltSize        = XmlHelper.ReadUInt(node.Attributes["saltSize"]);
            ctObj.blockSize       = XmlHelper.ReadUInt(node.Attributes["blockSize"]);
            ctObj.keyBits         = XmlHelper.ReadUInt(node.Attributes["keyBits"]);
            ctObj.hashSize        = XmlHelper.ReadUInt(node.Attributes["hashSize"]);
            ctObj.cipherAlgorithm = XmlHelper.ReadEnum <ST_CipherAlgorithm>(node.Attributes["cipherAlgorithm"]);
            ctObj.cipherChaining  = XmlHelper.ReadEnum <ST_CipherChaining>(node.Attributes["cipherChaining"]);
            ctObj.hashAlgorithm   = XmlHelper.ReadEnum <ST_HashAlgorithm>(node.Attributes["hashAlgorithm"]);

            if (node.Attributes["saltValue"] != null)
            {
                ctObj.saltValue = Convert.FromBase64String(node.Attributes["saltValue"].Value);
            }
            if (node.Attributes["encryptedVerifierHashInput"] != null)
            {
                ctObj.encryptedVerifierHashInput = Convert.FromBase64String(node.Attributes["encryptedVerifierHashInput"].Value);
            }
            if (node.Attributes["encryptedVerifierHashValue"] != null)
            {
                ctObj.encryptedVerifierHashValue = Convert.FromBase64String(node.Attributes["encryptedVerifierHashValue"].Value);
            }
            if (node.Attributes["encryptedKeyValue"] != null)
            {
                ctObj.encryptedKeyValue = Convert.FromBase64String(node.Attributes["encryptedKeyValue"].Value);
            }
            return(ctObj);
        }