使用OnGuard进行许可 [英] Licensing with OnGuard

查看:137
本文介绍了使用OnGuard进行许可的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我研究了使用OnGuard作为帮助诚实的人遵守其原则的方法。我同意许多人在这里表达的观点,即没有许可系统可以保护您免受想要使用您的软件并且不想付费的人的侵害。另一方面,我想避免让别人太容易为我的程序创建有效密钥。

Recently, I looked into using OnGuard as a way to help honest people abide by their principles. I agree with the views expressed by many here that no licensing system is going to protect you from someone who wants to use your software and does not want to pay for it. On the other hand, I would like to avoid making it too easy for someone else to create valid keys for my program.

在研究了手册和示例之后,我添加了以下是我主要表单的代码:

After studying the manual and examples, I added the following to my main form's code:

const
  TheKey: TKey = ($4A,$62,$F3,$2B,$9C,$D2,$84,$BF,$CB,$04,$0A,$C3,$3D,$11,$47,$1A);


function TfrmMain1.MakeCode(sName, sNumber: String; dtExpiration: TDate): String;
var Key: TKey;
    Code: TCode;
    sCode: String;
begin
  Key := TheKey;
  InitRegCode(Key, sName + ' - ' + sNumber, dtExpiration, Code);
  sCode := BufferToHex(Code, SizeOf(Code));
  Insert('-', sCode, 13);
  Insert('-', sCode, 09);
  Insert('-', sCode, 05);
  Result := sCode
end;

function TfrmMain1.TestCode(sName, sNumber, sTestCode: String; dtExpiration: TDate): Boolean;
var Key: TKey;
    Code: TCode;
    sCode: String;
begin
  sCode := MakeCode(sName, sNumber, dtExpiration);

  Result := SameText(sCode, sTestCode);
end;

这带来了一些问题:


  1. 看起来像使用此方法的正确方法吗?我宁愿不将它们的组件添加到我的表单中。

  1. Does seem like the correct way to use this? I would rather not add their components to my form.

由于OnGuard源可用,因此黑客无法反向工程我将选择并产生的密钥有效的发布代码?因此,我应该在代码中添加一些其他的混淆,还是削弱系统。

Since the OnGuard source is available, couldn't a hacker reverse engineer the Key I will choose and produce valid release codes? Should I therefore add some additional obfuscation to the code or might I just weaken the system.

此处的Key设置为常量。

The Key is set as a constant here. Won't it show up in the code as contiguous bytes and be easy to copy?

我的程序是否需要(至少)年度更新,而我的计划是通过年度订阅获得许可。将年份作为常数添加到我的程序中,并在几个地方测试该日期的用户条目是否会更强。

My program will require (at least) annual updates and my plan is to license it with an annual subscription. Would it be stronger to add the year as a constant in my program and test dated user entries against that year in a few places.

这里有四个密切相关且非常具体的问题。在四个单独的条目中询问这些问题,并且不得不添加上下文引用似乎更为尴尬,但是如果这样做更可取,我将很高兴这样做。谢谢您的帮助。

There are 4 questions here that are closely related and pretty specific. It seemed like it would be more awkward to ask those in four separate entries and have to add references for context but I will be glad to do that if that would be preferable. Thank you for your help.

杰克

推荐答案

  constructor TLincenceManager.Create;
  begin
    FSpecialCode := TOgSpecialCode.Create(nil);
    FSpecialCode.OnGetModifier := OgNetCodeGetModifier;
    FSpecialCode.OnChecked := OgNetCodeChecked;
    FSpecialCode.OnGetCode := OgNetCodeGetCode;
    FSpecialCode.OnGetKey := OgNetCodeGetKey;
    FSpecialCode.AutoCheck := False;
  end;

  function TLincenceManager.InitializeLicenceCode: Boolean;
  begin
    Result := FSpecialCode.CheckCode(True) = ogValidCode;
  end;

  procedure TLincenceManager.OgNetCodeChecked(Sender: TObject; Status: TCodeStatus);
  begin
    case Status of
      ogValidCode    : FMaxUsers := FSpecialCode.GetValue;
      ogInvalidCode  : FMaxUsers := 0;
      ogPastEndDate  : FMaxUsers := 0;
      ogDayCountUsed : FMaxUsers := 0;
      ogRunCountUsed : FMaxUsers := 0;
      ogNetCountUsed : FMaxUsers := 0;
      ogCodeExpired  : FMaxUsers := 0;
    else
      FMaxUsers := 0;
    end;
  end;

  procedure TLincenceManager.OgNetCodeGetCode(Sender: TObject; var Code: TCode);
  var
    FileName: string;
    SerialData: string;
    LicenceData: TStringList;
  begin
    FileName := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)));
    FileName := FileName + cLicenseFileName;
    SerialData := '';

    LicenceData := TStringList.Create;
    try
      if FileExists(FileName) then
      begin
        LicenceData.LoadFromFile(FileName);
        SerialData := LicenceData.Values['Serial'];
      end;

      {convert to proper form}
      HexToBuffer(SerialData, Code, SizeOf(Code));
    finally
      LicenceData.Free;
    end;
  end;

  procedure TLincenceManager.OgNetCodeGetKey(Sender: TObject; var Key: TKey);
  const
    CKey : TKey = ($4A,$62,$F3,$2B,$9C,$D2,$84,$BF,$CB,$04,$0A,$C3,$3D,$11,$47,$1A);
  begin
    Key := CKey;
  end;

  procedure TLincenceManager.OgNetCodeGetModifier(Sender: TObject; var Value: Integer);
  begin
    Value := GenerateMachineModifierPrim;
  end;




  1. 我已经发布了我的操作方法。我不使用视觉组件。我要做的就是这样,在您的情况下,您只需应用日期修饰符(我有机器修饰符)

  1. I have posted the way I do it. I do not use "visual" components. The way I do it is the way to go, in your case you just apply the date modifier (i have machine modifier)

理论上没有。生成许可证所使用的密钥至关重要。如果您拥有密钥,则可以破解许可证。但是只有代码您不能。这就像加密算法。您可以知道算法的工作原理,但是如果您没有密钥,就无法破解它。查看 XTEA 。这很简单,但很难破解。

No in theory no. The key with which you generate you licence is of essence. If you have the key you can crack the licences. But with only the code you cant. This is just like encryption algorithms. You can know how the algorithm works but if you don't have the key you cant crack it. Look at XTEA. It is very simple yet hard to crack.

是的,如果知道执行的操作,则可以从二进制文件中提取密钥。您可以在此处使用某种混淆方式。但是我不会打扰。对于大多数人来说,这样的保护就足够了,因此,如果您不制作下一个MS Office,我也不会打扰。人们对自己的产品狂妄自大。先出售它,然后再考虑。哦,因为它不是字符串,所以还是很难找到。

Yes the key can be extracted from binary if one knows what is doing. You could use some sort of obfuscation here. But I would not bother. For most people such protection is enough, so if you are not making the next MS Office I would not bother. People are way to paranaoid about their products. Sell it first and think about this later. Oh and since it is not a string it is a little harder to find anyway.

只需看一下onGuard随附的时间演示,就可以知道如何做有时间限制的许可证。但是请注意,只需对计算机时钟进行简单的操作就足以使它傻瓜。我认为最好的试用版软件就是这样,它缺少一些重要的功能(保存按钮...)。我认为很难进行良好的时间试用。

Just look at the time trial demos that come with onGuard to know how to do the time limited licence. However be aware that just simple manipulation of the computer clock will be enough to fool it. In my opinion best trial software is such, that is lack some vital functionality (save button...). Good time trials are very hard to make in my opinion.

这篇关于使用OnGuard进行许可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆