找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 526|回复: 3

[求助] 如何使用CAD自带的那个密码功能呢

[复制链接]

已领礼包: 6个

财富等级: 恭喜发财

发表于 2018-7-19 14:59:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
意思是使用Objectarx,调用CAD的那个给图纸加密码的接口;

开始本来想自己实现加密解密的,但是突然想到CAD有这个功能,仔细看了一下,有我找到的大部分加密库,就想着直接调用CAD的接口解决掉就好了,但是找了半天没找到相关接口,

请问大佬们,调用这部分的接口是哪些呀,有什么demo吗
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 20个

财富等级: 恭喜发财

发表于 2018-7-19 15:06:48 | 显示全部楼层
我虽然不懂,帮你顶
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 20个

财富等级: 恭喜发财

发表于 2018-7-19 15:11:57 | 显示全部楼层
这个不是加密,是用口令保护DWG,
是存盘的时候,加上的。

就是调用saveAs的时候,自己加入

AcDbDatabase::saveAs Function Acad::ErrorStatus

saveAs(

const ACHAR* fileName,

const SecurityParams* pSecParams = 0);

fileName Input file name or URL to write database out to
pSecParams Input pointer to a SecurityParams structure

Runs the save process on the database and writes the drawing information out to fileName. The fileName argument is taken as is. If no file extension is present, .dwg is not appended.

If the database executing the saveAs() function is not the current database in the AutoCAD editor, then the thumbnail preview image is not saved to fileName.

To specify security parameters, set pSecurity to point to a SecurityParams struct that conveys your preferences. If pSecurity is non-NULL, its settings override any previous database security settings. If pSecurity is NULL, any currently enforced security settings remain in effect. If no previous security-related settings were specified, and pSecurity is NULL, no security-related operation is attempted. If the SecurityParams struct passed as the pSecurity argument is not properly initialized, the method fails. See SecurityParams for more information on initializing this struct.

Returns Acad::eOk if process completes successfully.

============================

SecurityParams Struct This struct stores information for security operations requested during DWG file I/O.

Inherits From
None

Include File
dbsecurity.h
Members
Member Data   unsigned long cbSize  
  Size of the struct in bytes. This member must be set to sizeof(SecurityParams).  
  unsigned long ulFlags  
  Flags to indicate desired operations; can be one or more of the following enumerated values:
enum
{
    SECURITYPARAMS_ENCRYPT_DATA     = 0x00000001,
    SECURITYPARAMS_ENCRYPT_PROPS    = 0x00000002,

    SECURITYPARAMS_SIGN_DATA        = 0x00000010,
    SECURITYPARAMS_ADD_TIMESTAMP    = 0x00000020
};
At least one of SECURITYPARAMS_ENCRYPT_DATA or SECURITYPARAMS_SIGN_DATA must be set.  
  wchar_t * wszPassword  
  The password, formatted as a zero-terminated "wide-char" string  
  unsigned long ulProvType  
  Numeric ID of the cryptography provider. For more information on cryptography providers in Windows, please refer to the online Microsoft Developer Network (MSDN) documentation.  
  wchar_t * wszProvName  
  Name of the cryptography provider. For more information on cryptography providers in Windows, please refer to the online Microsoft Developer Network (MSDN) documentation.  
  unsigned long ulAlgId  
  Algorithm identifier; must be SECURITYPARAMS_ALGID_RC4.  
  unsigned long ulKeyLength  
  Length of the encryption key selected.  
  wchar_t * wszCertSubject  
  Name of the certificate (digital ID) subject.  
  wchar_t * wszCertIssuer  
  Name of the certificate (digital ID) issuer.  
  wchar_t * wszCertSerialNum  
  Serial number of the certificate (digital ID).  
  wchar_t * wszComment  
  Comment to be included with the signature.  
  wchar_t * wszTimeServer  
  This member contains the name of the time server used for timestamping. The name must be provided as a wide-char string in the format 揇escription(server_name)�. An example is 揘atl Inst of Standards and Technology(time.nist.gov)�.
If this member is NULL, the time from the local computer is used.  


论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 6个

财富等级: 恭喜发财

 楼主| 发表于 2018-7-19 21:21:08 | 显示全部楼层
marting 发表于 2018-7-19 15:11
这个不是加密,是用口令保护DWG,
是存盘的时候,加上的。

感谢回答,可惜我没早点看到大佬你的帖子,走了几个小时的弯路才在老大提示下发现了,这个其实也算加密的一种了,文件的加密,CAD内部应该也是这样子实现的;我只是用来作最初级的加密而已,应该足用。
不过这个有一个问题,就是一般打开dwg文件,是使用appContextOpenDocument,但是只有readDwgFile中,才有直接带入密码打开的,上述两种中都只能输入密码,而readDwgFile的文档又是静默文档,不能显式激活,请问大佬该如何解决?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-5-22 08:50 , Processed in 0.227610 second(s), 33 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表