Sets the crypt methods for encryption levels of type 4 or above.




void SetCryptMethods(CryptMethodType method)
void SetCryptMethods(CryptMethodType stringMethod, CryptMethodType streamMethod)

[Visual Basic]
Sub SetCryptMethods(method As CryptMethodType)
Sub SetCryptMethods(stringMethod As CryptMethodType, streamMethod As CryptMethodType)

Throws Exceptions may throw Exception()



Name Description
method The crypt method for strings and streams.
stringMethod The crypt method for strings.
streamMethod The crypt method for streams.




The default crypt method for Type 4 is V2, which uses RC4 algorithm. Crypt method settings are in effect only when Type is 4 or above.

The CryptMethodType enumeration can take any of the following values:

  • None – (Not supported.) An exception is thrown when it is used.
  • Identity – No encryption.
  • V2 – Uses the RC4 algorithm.
  • AESV2 – Uses the AES algorithm with 128-bit encryption keys.
  • AESV3 – Uses the AES algorithm with 256-bit encryption keys.

Because Adobe Reader does not support using more than one crypt methods per document (i.e. stringMethod≠streamMethod), an exception is thrown if you try to use multiple crypt methods. However, Identity is degenerate and can be used with other crypt methods.




Here we use 128-bit AES encryption.

Doc theDoc = new Doc();
theDoc.FontSize = 96;
theDoc.AddText("Hello World!");
theDoc.Encryption.Type = 4;

[Visual Basic]
Dim theDoc As New Doc()
theDoc.FontSize = 96
theDoc.AddText("Hello World!")
theDoc.Encryption.Type = 4