473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Encrypt password in PHP, decrypt in VB?

Hello

I'd like to encrypt a customer's organization name to use this as
their password to launch our application, and decrypt it within our
VB5 application.

We will then use this information to print it on every page that the
application prints out. That way, even if some other user gives out
his password, it won't do any good, since the organization name will
be the original user's.

I guess there are two things I need to solve:
- how to to check that the password is valid, and not just some crap
an unlicensed user typed just to get past the logon dialog?

- find a light encryption/decryptiong algorithm that can be used in
PHP to create passwords on our web server, and the corresponding
decryption part to be implemented in VB5 (preferably as source code,
to void shipping another DLL).

Thank you for any hint.
Jul 1 '08 #1
4 2762
Gilles Ganault wrote:
I'd like to encrypt a customer's organization name to use this as
their password to launch our application, and decrypt it within our
VB5 application.
Er... You're mixing concepts here. Encrypted stuff is not a "password", it's
called "cyphertext". Are you saying that you want to use cyphertext as a
sort of password or license key?
In any case, you'll have to research into non-simmetrical encruption
algorithms. If you implemented a simmetrical one, then your users would
have both the cyphertext and the key to create new cyphertexts suited to
them.
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Now listening to: Tone - Small Arm of Sea (2008) - [7] Undecided (3:28)
(74.500000%)
Jul 1 '08 #2
On Jul 1, 10:08*am, Gilles Ganault <nos...@nospam.comwrote:
* * * * I'd like to encrypt a customer's organization name to use this as
their password to launch our application, and decrypt it within our
VB5 application.
This is how I understand it:
Alice works at OrgaCorp. The string "OrgaCorp" will be encrypted, so
that it becomes "PshbDpsq". This will then be the password of Alice.
Alice logs in using Alice, PshdDpsq as her username and password and
this information is passed to a VB application, which then decodes the
company name to do something with it.

A simple way to encrypt a word is using XOR encryption. So you bitwise
XOR the company name with some other string. However, if a smart user
gets his hands on some passwords, he can deduce your encryption string
from it. XOR encryption is not particularly safe.

XOR encryption is a way of a symetrical encryption. The other poster
said you should use asymetrical encryption, which means that the key
to encrypt the data is another key than the one to decrypt the data.
It depends on your situation which one you should use.

Another solution could be to put username, company, password data in a
database, so that you can check the password and find the right
company for the user.
We will then use this information to print it on every page that the
application prints out. That way, even if some other user gives out
his password, it won't do any good, since the organization name will
be the original user's.
I don't understand this.
I guess there are two things I need to solve:
- how to to check that the password is valid, and not just some crap
an unlicensed user typed just to get past the logon dialog?
You have to encrypt some extra data which serves as a validity check.
For example, instead of encrypting OrgaCorp you can encrypt
GOODOrgaCorp. You then assume that if the decrypted string starts with
GOOD, the password is correct.

For safety reasons, you would not prepend a fixed string but some hash
of the word.

Maybe you are solving your problem the wrong way. Could you explain it
a little more in detail, maybe with an example?
Jul 1 '08 #3
On Tue, 1 Jul 2008 04:24:43 -0700 (PDT), Sjoerd <sj******@gmail.com>
wrote:
>You have to encrypt some extra data which serves as a validity check.
For example, instead of encrypting OrgaCorp you can encrypt
GOODOrgaCorp. You then assume that if the decrypted string starts with
GOOD, the password is correct.
Yup, that's what I had in mind.
>Maybe you are solving your problem the wrong way. Could you explain it
a little more in detail, maybe with an example?
It's not my line of business, so it's a bit fuzzy at this point but
the goal is two-fold:
1. make sure the user has bought a license, and doesn't use someone
else's
2. make sure the user has bought this year's license, and doesn't keep
using last year's.

So I was thinking of
1. taking the organization's name, eg. "Acme Inc.", and prepend it
with the current year, eg. "2008-Acme Inc."
2. encrypt/cypher this string
3. add a suffix to that cyphered string so that I know it looks real.
Obviously, any computer-savvy person who has access to two keys will
see that the last X bytes are similar, but our users are not
computer-savvy and this is a niche application
4. in the VB application, decypher this, check that the current year
is the same as the one in the key, and use the organization name in
all printouts, so that it's useless for "Widget Inc." to use "Acme
Inc.'"s key.

Am I totally off-base?

Thank you.
Jul 1 '08 #4
On Tue, 1 Jul 2008 Gilles Ganault <no****@nospam.comwrote:
Hello

I'd like to encrypt a customer's organization name to use this as
their password to launch our application, and decrypt it within our
VB5 application.

We will then use this information to print it on every page that the
application prints out. That way, even if some other user gives out
his password, it won't do any good, since the organization name will
be the original user's.

I guess there are two things I need to solve:
- how to to check that the password is valid, and not just some crap
an unlicensed user typed just to get past the logon dialog?

- find a light encryption/decryptiong algorithm that can be used in
PHP to create passwords on our web server, and the corresponding
decryption part to be implemented in VB5 (preferably as source code,
to void shipping another DLL).
Hi.

How about when someone logs in they provide username, company name, password.
Concatenate these and MD5 them. This MD5 string is then what is stored.
When someone logs into the VB app with the same details (and thereby providing
you the company name to display on print outs) you carry out the same
concatenation and MD5. If the two md5 strings match it's a valid login.
Otherwise it isn't.

D.
--
You don't stop playing games because you get old.
You get old because you stop playing games.
Jul 2 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Anilza Popat | last post by:
I would like to know how to encrypt and decrypt files using c#. I want a program that asks for password before encrypt or decrypt the file. best regards
8
by: Gidi | last post by:
Hi, Is there Buid-In fuction in C# that Encrypt and Decrypt strings? i have a textbox which i'm writing into file, and i want to encrypt it before writing, i'm not looking for something fancy,...
2
by: Greg R | last post by:
Where can I find a code example that will demonstrate the encryption and decryption of a string in C# I am familiar with "System.Security.Cryptography" encryption, but need a system that will both...
0
by: Randall Parker | last post by:
I'm just learning web security and so this might be a naive question: I'm looking here:...
0
by: vermarajeev | last post by:
Hi guys, I have written a function to encrypt and decrypt a file using crypto++. I have made use of crypto++ API's to do that. These API's take one input file(plain text) and outputfile(encrypted...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
2
by: vermarajeev | last post by:
Anyone here know how to use crypto++ library or anyone has used crypto++ library to encrypt or decrypt a file? Thanks
4
by: svsugu | last post by:
i need the codes in C# to encrypt and decrypt a message which we sent as email.......
2
by: Dandirom | last post by:
Hi guys, I need help. I'd appreciate any pointers on how to go about with this problem. Thanks a lot. Using arrays and/or pointers, make a prog that will ask for a string. 2 user-defined...
4
by: kiranbabu | last post by:
Any one help me how to encrypt and decrypt passwords.And the password field is in database(mysql database) how to encrypt and decrypt that password saved in database.
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.