Old 18th June 2003, 18:36   #1
roboldham
Junior Member
 
Join Date: Jun 2003
Posts: 3
Verifying serial number in installer itself

Hi there

This is what I need to do:

Customer purchases HTML content and PDFs off website, is given a serial number that is generated from their e-mail.

They then download their installer (written in NSIS of course!) and they then enter their email address and given serial number.

It doesnt need to be super secure, but I want to perform a simple check that the two match up.

I have some BASIC that can do it, but can it be implemented in NSIS scripting? (see below) MANY THANKS!

Function Encrypt(Text As String, EncryptKey As Integer)
Dim Temp As String, RR As Integer
For RR = 1 To Len(Text)
Temp$ = Temp$ + Chr$(Asc(Mid(Text, RR, 1)) Xor EncryptKey)
Next RR
Encrypt = Temp
End Function

Password = Encrypt(Password, Len(Password) + 77)
roboldham is offline   Reply With Quote
Old 18th June 2003, 18:42   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Not all these functions are available, but there are similar instructions you can use to create basic encryption.

For more advanced stuff, you can write a C/C++/Delphi plug-in.
Joost Verburg is offline   Reply With Quote
Old 18th June 2003, 18:46   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You need to firstly create an InstallOptions page (${NSISDIR}\Contrib\InstallOptions\)
With that you can use ReadINIStr to get entered values from field boxes / password boxes etc like so:
ReadINIStr $0 "$PLUGINSDIR\IOfile.ini" "Field 2" "State"

You can then compare your password like so:

StrCmp $0 [yourpassword] correct incorrect
correct:
;stuff to do if password is not wrong
Goto passend
incorrect:
;suff to do if password is wrong
passend:

You can get the user to re-enter their password using a messagebox:
MessageBox MB_OK|MB_ICONEXCLAMATION "Password incorrect!!!$\nYou must re-enter your given password." IDOK pagetop
That will jump to the pagetop label, which you put above the InstallOptions call like so:

Page Custom "PasswordDialog" "" " - Enter Serial Code"
Funcion PasswordDialog
File /oname=$PLUGINSDIR\iofile.ini "${NSISDIR}\myapp\iofile1.ini"
pagetop:

InstallOptions::dialog "$PLUGINSDIR\iofile.ini"
Pop $R0
StrCmp $R0 back pagebottom ;if user presses back
StrCmp $R0 cancel pagebottom ;if user presses cancel

ReadINIstr $R0 "$PLUGINSDIR\iofile.ini" "Field 2" "State"
StrCmp $R0 xyz321 passok

MessageBox MB_OK|MB_ICONEXCLAMATION "Serial Code is incorrect!" IDOK paketop

passok:
FunctionEnd

-Stu
Afrow UK is offline   Reply With Quote
Old 18th June 2003, 21:56   #4
roboldham
Junior Member
 
Join Date: Jun 2003
Posts: 3
Ok thanks guys, that gave me some pointers!

I am suprised no-one had tried this out yet!

Will let you know how I get on.

Thanks again

R
roboldham is offline   Reply With Quote
Old 19th June 2003, 00:18   #5
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
I'll be cooller if IO can encrypt the text from passwords objects.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump