LayerCOS_Layer
ObjectEncryption_and_Decryption

The Cos layer provides methods to encrypt and decrypt data in arbitrary memory blocks. The encryption and decryption uses Acrobat's built-in algorithm (RC4 from RSA Data Security, Inc.) and a key that can be specified.



Typedef Summary
 Typedef
 CosCryptVersion
Callback Summary
 Callback
 CosCryptStringProc
A prototype for the string encryption/decryption callback. This is part of the Crypt Filter mechanism.
Method Summary
 Method
 
ASTVersion CosCryptGetVersion()
Gets the current version number of the encryption algorithm supported.
 
void CosDecryptData(void* src, ASTArraySize len, void* dst, char* cryptData, ASTArraySize cryptDataLen)
Decrypts data in a buffer using the specified encryption key. The standard Acrobat viewer encryption/decryption algorithm (RC4 from RSA Data Security, Inc.) is used.
 
CosByteMax CosDecryptGetMaxKeyBytes(ASTVersion cryptVersion)
Gets the maximum number of the decryption key length, in bytes, for the specified cryptVersion.
 
void CosEncryptData(void* src, ASTArraySize len, void* dst, char* cryptData, ASTArraySize cryptDataLen)
Encrypts data in a buffer using the specified encryption key. The standard Acrobat viewer encryption/decryption algorithm (RC4 from RSA Data Security, Inc.) is used.
 
CosByteMax CosEncryptGetMaxKeyBytes(ASTVersion cryptVersion)
Gets the maximum number of the encryption key length, in bytes, for the specified cryptVersion.

Typedefs Detail
CosCryptVersion 
Product availability: All
Platform availability: All

Syntax

typedef ASInt32 CosCryptVersion;

File: CosExpT.h
Line: 31


Callbacks Detail
CosCryptStringProc 
Product availability: All
Platform availability: All

Syntax

ASInt32 (*CosCryptStringProc)(CosDoc dP, ASAtom filterName, char *dest, char *src, ASInt32 dstSize, ASInt32 srcLength, ASUns32 genNumber, ASUns32 objNumber)

A prototype for the string encryption/decryption callback. This is part of the Crypt Filter mechanism.


File: CosExpT.h
Line: 321

Method Detail
CosCryptGetVersion()
Product availability: All
Platform availability: All

Syntax

ASTVersion CosCryptGetVersion()

Gets the current version number of the encryption algorithm supported.

Returns

The current version number of the encryption supported.

See Also

Since

PI_COS_VERSION >= 0x00040005

File: CosProcs.h
Line: 1356
CosDecryptData() 
Product availability: All
Platform availability: All

Syntax

void CosDecryptData(void* src, ASTArraySize len, void* dst, char* cryptData, ASTArraySize cryptDataLen)

Decrypts data in a buffer using the specified encryption key. The standard Acrobat viewer encryption/decryption algorithm (RC4 from RSA Data Security, Inc.) is used.

An exception is raised if encryption encounters an internal error.

Parameters

src — 

The buffer containing the data to decrypt.

 
len — 

The number of bytes in src.

 
dst — 

(Filled by the method) The buffer into which the decrypted data will be placed. This may point to the same location as src.

 
cryptData — 

The encryption key.

 
cryptDataLen — 

The length of the encryption key in bytes. It cannot be greater than 5.

See Also

Since

PI_COS_VERSION >= 0x00020000

File: CosProcs.h
Line: 978
CosDecryptGetMaxKeyBytes() 
Product availability: All
Platform availability: All

Syntax

CosByteMax CosDecryptGetMaxKeyBytes(ASTVersion cryptVersion)

Gets the maximum number of the decryption key length, in bytes, for the specified cryptVersion.

Parameters

cryptVersion — 

IN/OUT The Cos crypt version, which is the version of the algorithm that is used to encrypt and decrypt document data. cryptVersion equal to 0 is treated as cryptVersion equal to 1 to maintain backward compatibility.

Returns

The maximum number of key length, in bytes, for the specified cryptVersion. If cryptVersion is not currently supported, it returns -1.

See Also

Since

PI_COS_VERSION >= 0x00040005

File: CosProcs.h
Line: 1372
CosEncryptData() 
Product availability: All
Platform availability: All

Syntax

void CosEncryptData(void* src, ASTArraySize len, void* dst, char* cryptData, ASTArraySize cryptDataLen)

Encrypts data in a buffer using the specified encryption key. The standard Acrobat viewer encryption/decryption algorithm (RC4 from RSA Data Security, Inc.) is used.

An exception is raised if encryption encounters an internal error.

Parameters

src — 

The buffer containing the data to encrypt.

 
len — 

The number of bytes in src.

 
dst — 

(Filled by the method) The buffer into which the encrypted data will be placed. This may point to the same location as src.

 
cryptData — 

The encryption key.

 
cryptDataLen — 

Length of the encryption key, in bytes. It cannot be greater than 5.

See Also

Since

PI_COS_VERSION >= 0x00020000

File: CosProcs.h
Line: 1000
CosEncryptGetMaxKeyBytes() 
Product availability: All
Platform availability: All

Syntax

CosByteMax CosEncryptGetMaxKeyBytes(ASTVersion cryptVersion)

Gets the maximum number of the encryption key length, in bytes, for the specified cryptVersion.

Parameters

cryptVersion — 

IN/OUT The Cos crypt version, which is the version of the algorithm that is used to encrypt and decrypt document data. cryptVersion equal to 0 is treated as cryptVersion equal to 1 to maintain backward compatibility.

Returns

The maximum number of key length, in bytes, for the specified cryptVersion. If cryptVersion is not currently supported, it returns -1.

See Also

Since

PI_COS_VERSION >= 0x00040005

File: CosProcs.h
Line: 1388