-
Notifications
You must be signed in to change notification settings - Fork 4
/
Chapter17.txt
46 lines (39 loc) · 1.51 KB
/
Chapter17.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Public Sub SaveWithEncryption()
Dim oSecurity As New AcadSecurityParams
With oSecurity
.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
.Comment = "Add comment to drawing"
.Issuer = "Your Company Name"
.KeyLength = 40
'AutoCAD converts all passwords to uppercase before applying them
.Password = UCase("br549")
.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
.ProviderType = 1
.SerialNumber = "BR549"
.Subject = "The Flying DeLorean"
.TimeServer = "NIST(time.nist.gov)"
End With
ThisDrawing.SaveAs "C:\MyDrawing.dwg", , oSecurity
End Sub
Dim sp As New AcadSecurityParams
sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
Dim sp As New AcadSecurityParams
sp.Issuer = "Personal Freemail RSA 2000.8.30"
Dim sp As New AcadSecurityParams
sp.SerialNumber = "073848"
Dim sp As New AcadSecurityParams
sp.TimeServer = "NIST(time.nist.gov)"
Public Sub SaveLockedDrawing()
' This example encrypts and saves a file.
Dim acadApp As New AcadApplication
Dim sp As New AcadSecurityParams
acadApp.Visible = True
sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
sp.KeyLength = 40
sp.Password = UCase("unique-password)
sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
sp.ProviderType = 1
acadApp.ActiveDocument.SaveAs "C:\LockedDrawing1.dwg", , sp
End Sub