首页/文章/ 详情

HyperMesh二次开发-程序license发布与非对称加密过程详解

1月前浏览163

在软件的开发中,当涉及到到知识产权的时候,不得不考虑软件的许可证问题,为了保护知识产权并确保许可机制的有效性,就需要引入加密技术。

常用的加密方式对称加密和非对称加密。


对称加密

对称加密是经典的加密方式,核心思想是采用相同的逻辑进行加密与解密。这表示发送方和接收方必须提前共享密钥或者了解加密步骤。对称加密的基本原理是对需要加密的参数进行乱转换,使得只有知道转换过程的就能解开。


著名的对称加密方式是恩尼格玛密码机(Enigma Machine)。

在第二次世界大战中被广泛使用。恩格码机的设计极为复杂且实现了多层加密,但最终还是被炸弹机破解。破解的方向在于,密文截获达到一定数量,这就是致命点之一,当截获的密文足够多时,通过分析密文依然能判断出加密方式。


即使对明文进行了多种加密转换策略,但是一旦掌握了加密规律,当样本量足够多时,总是可以反推回来的,这就是对称加密的解密技术时也有其局限性,这也是加密的对称性。

在实际应用中,肯定是能起到加密效果的,也不是那么容易能解决的。


非对称加密

现代密码学的发展引入了非对称加密技术,解决了对称加密在密钥管理上的问题。非对称加密使用一对密钥:公钥和私钥。公钥用于加密数据,而私钥则用于解密。这种设计使得即便公钥被广泛公开,只要私钥没有泄露,即使知道加密过程,整个加密系统依然是安全的。

其中,RSA算法是非对称加密的经典代表。RSA(Rivest-Shamir-Adleman)算法是一种非对称加密算法,广泛应用于信息安全领域。核心是基于两个大素数的乘积的难解因子分解问题,其安全性依赖于大素数的难解性。其基本过程如下:



加密由公钥,私钥,明文,密文,四部分组成,下面展示下完整的计算过程,公众 号编辑器不支持markdown格式的所以直接粘贴的图片。



上述过程实现了私钥和公钥的计算,加密和解密的计算过程。由于模运算的特性,给定密文和公钥(e, n),也是无法反推出明文M;而只有持有私钥的接收方可以轻松恢复信息。可能有小伙伴在这里有疑问,这么简单的数字,暴力破解轻松拿下,那么当密钥换成1024位的,试试呢。




目前大多数的商业软件单机版是通过获取计算机的MAC地址或其它固件信息来判断当前电脑所安装的软件是否满足其许可要求。这种基于硬件特征的对称性检测可以有效防止软件的非授权使用,同时生成的密文中可以包含许可时间,启动时与系统时间比较,判断license是否到期。


加密技术在软件开发与许可发布中扮演着至关重要的角色。可以有效保护软件的知识产权和用户的数据安全。


上述讲的是通过正常途径来猜测licence,但是就计算机软件而言不用这么复杂,可以通过汇编语言,对程序验证的代码能跳过,当然了过程也不是那么简单。


来源:TodayCAEer
HyperMesh二次开发
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2024-08-14
最近编辑:1月前
TodayCAEer
本科 签名征集中
获赞 16粉丝 9文章 164课程 0
点赞
收藏
作者推荐

HyperWork 2024 -二次开发-Tcl语言-proc(9/12)

Proceduresorganizearepetitivegroupofcommandsintoalogicalblockandallowforargumentstobeparameterized.Theyimproveperformanceandmemorybecauseaprocedure’scommandsandvariablesonlyexistwithinthescopeoftheprocedure.Thismeansthatvariablescreatedinsideaprocedureonlyexistwhiletheprocedureisexecutedandaredestroyedwhentheprocedurereturns.Theproccommandisusedtodefineaprocedure.Thereareoptionalargumentsthatcanbedefinedforaprocedureasvaluesthatwillbepassedtotheprocedurewhentheprocedureiscalled.Eachparameterbecomesavariableintheprocedure.Thecommandscontainedwithinthecurlybracesarerunwhentheprocedureiscalled.Theformatofaprocedureis:procname{?arg1??arg2?etc…}{body}Afteraprocedureisdefined,itisusedjustlikeanyotherTclcommand.ThenameoftheprocedurebecomesanewTclcommandnameandiscalledjustlikeanystandardTclcommand.Inthisway,itisalsopossibletoredefine(orundefine)thefunctionofexistingTclcommands.Anexampleprocedurenamedcurve_infothattakescurve_referenceandcolorasitsarguments:proccurve_info{curve_referencecolor}{puts"Curvereference=$curve_reference";puts"Curvecolor=$color";}curve_infop1w1c15;Curvereference=p1w1c1Curvecolor=5Thenameargsisaspecialprocedureparameterwhenyoudon'tknowhowmanyargumentswillbeused.Thisisusefulwhencreatingacontextmenuwheremultipleitemsmaybepassed.procnode_info{args}{foreachnode$args{puts"Node=$node";}}node_infonode1node2node3;Nodereference=node1Nodereference=node2Nodereference=node3Variablesaretreatedasoneargumentanddonotrequiretheargsparameter.procnode_info{node_list}{foreachnode$node_list{puts"Node=$node";}}setnode_list"node1node2node3";node_info$node_list;Nodereference=node1Nodereference=node2Nodereference=node3Thereturncommandisusedtoexitaprocedure.Thisishandyforerrorcontrol.procnode_info{args}{if{[llength$args]==0}{puts"Nonodesareselected";return;}foreachnode$args{puts"Node=$node";}}curve_info;Nocurvesareselectedcurve_infonode1node2node3;Node=node1Node=node2Node=node3Thereturncommandcanalsobeusedtoassigntheresultsofaproceduretoavariable.procadd_three_numbers{num1num2num3}{setsum[expr$num1+$num2+$num3];return$expression;}setsum[add_three_numbers245];puts$sum;11Procedurenames,bydefault,aredefinedintheglobalscope(toplevel)ofaTclscript.Anyvariablesthataredefinedoutsideofaprocedurearealsopartoftheglobalscopeandarecalledglobalvariables.Differentnamespacesexistforprocedurenamesandglobalvariablessoitispossibletohaveproceduresandvariableswiththesamenamewithoutissue.Itisalsopossible,andrecommended,tousetheTclnamespacefacilitytomanagethescopeofproceduresandvariables.Asmentionedabove,allvariablesdefinedwithinaprocedurearelocaltothatprocedure.Thismeansthat,unlessotherwisedefined,avariabledefinitiononlyexists,andisonlyaccessible,fromwithintheprocedureitiscreatedin.setelement_list"12345";procelement_info{}{puts$element_list;setnode_list"10203040";puts$node_list;}element_info;can'tread"element_list":nosuchvariable10203040puts$element_list;12345puts$node_list;can'tread"node_list":nosuchvariableThisalsoallowstheprogrammertodefinethesamelocalvariablewithindifferentprocedureswithoutanyconflict.procnode_info_1{}{puts$node_list;setnode_list"10203040";puts$node_list;}procnode_info_2{}{puts$node_list;setnode_list"10203040";puts$node_list;}node_info_1;can'tread"node_list":nosuchvariable10203040node_info_2;can'tread"node_list":nosuchvariable10203040Asageneralrule,itisgoodpracticetocreatefocusedproceduresthathavespecificfunctionswhicharemodularandreusable.Thisallowstheproceduretoperformaspecificoperationthatallowsotherdeveloperstoeasilyseewhatfunctiontheprocedureperforms.Italsoallowsprocedurestobereusedinotherscriptsthatmayrequiresimilarfunctions.来源:TodayCAEer

未登录
还没有评论
课程
培训
服务
行家
VIP会员 学习 福利任务 兑换礼品
下载APP
联系我们
帮助与反馈