Share via


DocumentBase.PasswordEncryptionKeyLength 속성

Microsoft Office Word에서 문서를 암호로 암호화할 때 사용하는 알고리즘의 키 길이를 가져옵니다.

네임스페이스:  Microsoft.Office.Tools.Word
어셈블리:  Microsoft.Office.Tools.Word.v4.0.Utilities(Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

구문

‘선언
Public ReadOnly Property PasswordEncryptionKeyLength As Integer
    Get
public int PasswordEncryptionKeyLength { get; }

속성 값

형식: System.Int32
Microsoft Office Word에서 문서를 암호로 암호화할 때 사용하는 알고리즘의 키 길이

설명

Word에서 문서를 암호로 암호화하는 데 사용하는 키 길이를 지정하려면 SetPasswordEncryptionOptions 메서드를 사용합니다.

예제

다음 코드 예제에서는 암호 암호화 키 길이가 40 미만인 경우 암호 암호화 옵션을 설정합니다. 이 예제를 사용하려면 문서 수준 프로젝트 ThisDocument 클래스에서 실행하십시오.

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 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

DocumentBase 클래스

Microsoft.Office.Tools.Word 네임스페이스