CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

算法属性 (ActiveX)

2023-1-2 22:42| 发布者: admin| 查看: 176| 评论: 0|来自: AutoCAD

摘要: 指定加密算法的标识符。(已过时)

指定加密算法的标识符。(已过时)

支持的平台:仅窗口

签名

工 务 局:

object.Algorithm
对象

类型:安全参数

此属性适用的对象。

属性值

只读:

类型:长;枚举AcadSecurityParamsConstants

仅指定以下常量。

  • ACADSECURITYPARAMS_ALGID_RC4: 0x00006801

言论

注意:从基于 AutoCAD-2016 的产品开始,使用密码保护图形文件的功能已停止使用。

例子

工 务 局:

Sub Example_Algorithm()
    ' This example encrypts and saves a file.
    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")
    
    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
    sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
    sp.KeyLength = 40
    sp.Password = UCase("mypassword") 'AutoCAD converts all passwords to uppercase before applying them
    sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
    sp.ProviderType = 1
    
    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Algorithm()
    ;; This example encrypts and saves a drawing file.

    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    (vla-put-Action sp ACADSECURITYPARAMS_ENCRYPT_DATA)
    (vla-put-Algorithm sp ACADSECURITYPARAMS_ALGID_RC4)
    (vla-put-KeyLength sp 40)
    (vla-put-Password sp (strcase "mypassword"))
    (vla-put-ProviderName sp "Microsoft Base Cryptographic Provider v1.0")
    (vla-put-ProviderType sp 1)

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-11 14:25

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部