Document.PasswordEncryptionKeyLength Property (2007 System)
Gets the key length of the algorithm Microsoft Office Word uses when encrypting documents with passwords.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property PasswordEncryptionKeyLength As Integer
'Usage
Dim instance As Document
Dim value As Integer
value = instance.PasswordEncryptionKeyLength
[BrowsableAttribute(false)]
public int PasswordEncryptionKeyLength { get; }
[BrowsableAttribute(false)]
public:
property int PasswordEncryptionKeyLength {
int get ();
}
public function get PasswordEncryptionKeyLength () : int
Property Value
Type: System.Int32
The key length of the algorithm Microsoft Office Word uses when encrypting documents with passwords.
Remarks
Use the SetPasswordEncryptionOptions method to specify the key length that Word uses when encrypting documents with passwords.
Examples
The following code example sets the password encryption options if the password encryption key length is less than 40.
This example is for a document-level customization.
Private Sub DocumentPasswordEncryptionKeyLength()
If Me.PasswordEncryptionKeyLength < 40 Then
Dim PasswordEncryptionProvider As String = _
"Microsoft RSA SChannel Cryptographic Provider"
Dim PasswordEncryptionAlgorithm As String = "RC4"
Dim PasswordEncryptionKeyLength As Integer = 56
Dim PasswordEncryptionFileProperties As Object = True
Me.SetPasswordEncryptionOptions(PasswordEncryptionProvider, _
PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength, _
PasswordEncryptionFileProperties)
End If
End Sub
private void DocumentPasswordEncryptionKeyLength()
{
if (this.PasswordEncryptionKeyLength < 40)
{
string PasswordEncryptionProvider = "Microsoft RSA SChannel Cryptographic Provider";
string PasswordEncryptionAlgorithm = "RC4";
int PasswordEncryptionKeyLength = 56;
object PasswordEncryptionFileProperties = true;
this.SetPasswordEncryptionOptions(PasswordEncryptionProvider,
PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength,
ref PasswordEncryptionFileProperties);
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.