Udostępnij za pośrednictwem


Document.PasswordEncryptionAlgorithm Property (2007 System)

Gets the algorithm Microsoft Office Word uses for 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 PasswordEncryptionAlgorithm As String
'Usage
Dim instance As Document 
Dim value As String 

value = instance.PasswordEncryptionAlgorithm
[BrowsableAttribute(false)]
public string PasswordEncryptionAlgorithm { get; }
[BrowsableAttribute(false)]
public:
property String^ PasswordEncryptionAlgorithm {
    String^ get ();
}
public function get PasswordEncryptionAlgorithm () : String

Property Value

Type: System.String
The algorithm Microsoft Office Word uses for encrypting documents with passwords.

Remarks

Use the SetPasswordEncryptionOptions method to specify the algorithm that Word uses for encrypting documents with passwords.

Examples

The following code example sets the password encryption to a stronger encryption if the password encryption algorithm in use is "OfficeXor".

This example is for a document-level customization.

Private Sub DocumentPasswordEncryptionAlgorithm()
    If Me.PasswordEncryptionAlgorithm = "OfficeXor" 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 DocumentPasswordEncryptionAlgorithm()
{
    if (this.PasswordEncryptionAlgorithm == "OfficeXor")
    {
        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

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace