2.3.5.1 RC4 CryptoAPI Encryption Header

The encryption header structure used for RC4 CryptoAPI encryption is specified as shown in the following diagram.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

EncryptionVersionInfo

EncryptionHeader.Flags

EncryptionHeaderSize

EncryptionHeader (variable)

...

EncryptionVerifier (variable)

...

EncryptionVersionInfo (4 bytes): A Version structure (section 2.1.4) that specifies the encryption version used to create the document and the encryption version required to open the document. Version.vMajor MUST be 0x0002, 0x0003, or 0x0004<21> and Version.vMinor MUST be 0x0002.

EncryptionHeader.Flags (4 bytes): A copy of the Flags stored in the EncryptionHeader structure (section 2.3.2) that is stored in this stream (1).

EncryptionHeaderSize (4 bytes): An unsigned integer that specifies the size, in bytes, of the EncryptionHeader structure.

EncryptionHeader (variable): An EncryptionHeader structure (section 2.3.2) used to encrypt the structure. The values MUST be set as described in the following table.

Field

Value

Flags

The fCryptoAPI bit MUST be set. The fDocProps bit MUST be set if the document properties are not encrypted.

SizeExtra

MUST be 0x00000000.

AlgID

MUST be 0x00006801 (RC4 encryption).

AlgIDHash

MUST be 0x00008004 (SHA-1).

KeySize

MUST be greater than or equal to 0x00000028 bits and less than or equal to 0x00000080 bits, in increments of 8 bits. If set to 0x00000000, it MUST be interpreted as 0x00000028 bits. It MUST be compatible with the chosen cryptographic service provider (CSP).

ProviderType

MUST be 0x00000001.

Reserved1

Undefined and MUST be ignored.

Reserved2

MUST be 0x00000000 and MUST be ignored.

CSPName

MUST be set to a recognized CSP name that supports RC4 and SHA-1 algorithms with a key length compatible with the KeySize field value.<22>

EncryptionVerifier (variable): An EncryptionVerifier structure as specified in section 2.3.3 that is generated as specified in section 2.3.5.5.