C # Excel file encryption, supporting xlsx, docx, pptx (C # \ Net \ Asp. Net ),

Source: Internet
Author: User

C # Excel file encryption, supporting xlsx, docx, pptx (C # \ Net \ Asp. Net ),

From now on, I have closed it! No access is allowed!

A man like a wind has the same character as a wind. The problem arises. When the wind encounters sand, you may not beWind child, I amSha ErOfTangle,. It may be the sky, yellow sand, flying grain stone. If we want to hide the dust of the sky, we must have a strong arm! Then, the Internet, the Internet, and the Internet! Let him close it down honestly,Always cuddling, Ala!

Read at the beginning:

1,Excel file encryption implementation. This article uses Microsoft Office 2007 as an example.

2. Microsoft Office 2007 Office is based on Open XML file (also known as OOXML or OpenXML or MOX ). IsXMLAndZIP CompressionElectronic File specifications, supportedDocuments, tables, memos, slidesFile Format)

3. This article implements C-end Excel encryption and S-end Excel encryption (no server components need to be installed,Say goodbye to all troubles).

4. encryption of this document can be used to encrypt files such as .docx,. xlsx, And. pptx.

 

So, let's take the sour food!

1. Download our dependent components

Download encryption component

2. Encryption! Starting work! Over!

The project introduces NPOI. POIFS. dll, NPOI. Util. dll, and OfficeOpenXmlCrypto. dll. The detailed implementation code is as follows:

using (OfficeCryptoStream stream = OfficeCryptoStream.Open(@"location"))
{
     stream.Password = "password";
     stream.Save();
}

Note:

1. Code Description: location: Encrypted File Path, password: encrypted password

2, encryption principle: Based on AES128, encryption key generation method: SHA1, specific encryption technology details see MS-OFFCRYPTO

3. Other encryption technology stacks: EPPlus class library, OpenXml 2.0 SDK. For more information, see explosion network-like encryption qa.

4. If it is deployed on iis, you must enable the 32-Bit mode of the application pool corresponding to the website.

5. Reference Link (all walls, self-built VPN ):

(1), http://www.lyquidity.com/devblog? P = 35

(2), https://msdn.microsoft.com/en-us/library/cc313071.aspx

(3), https://en.wikipedia.org/wiki/Office_Open_XML

(4), https://code.google.com/archive/p/ooxmlcrypto/

 

By: dolphin Bay-Feng


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.