Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Base64,MD5,Crypt,SSL with Basic4PPC..?

Reply
 
LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 05-08-2008, 07:51 PM
Senior Member
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 154
Default

Hello agraham,

good news and bad news: the crypt dll works fine so far, but does not return the expected string.

I found this link here, which can calculate the crypt without the need of a own Unix/ Linux pc:

The JavaScript Source: Password Protection: UNIX crypt(3) encryption

I tested it and got exactly the result i expect to get, so you could use it to verify if your lib is using the correct algorithm.

Can you have a look into this again..? I assume now it is the crypt(3) algo as mentioned on wikipedia.Wikipedia also mentions different hash algorithms, maybe there's the crux..?

cheers

TWELVE
Reply With Quote
  #22 (permalink)  
Old 05-09-2008, 08:40 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

This seems better. I made a typo in the conversion from C to C# code.

EDIT: Web stuff is not my scene but I have just noticed that .NET HTTPWebRequest and HTTPWebResponse classes (as used by the HTTP library) are supposed to support SSL - how you actually do it with certificates or whatever and whether the Door library could do any necessary twiddling I haven't a clue!
Attached Files
File Type: zip CryptDLLdemo.zip (3.9 KB, 119 views)

Last edited by agraham : 05-09-2008 at 09:11 AM.
Reply With Quote
  #23 (permalink)  
Old 05-09-2008, 09:51 AM
Senior Member
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 154
Default

Hello agraham,

again thank you very much !!! I just replaced the lib and that's it.It returns now the expected crypt string.I cannot say this enough: your work is an unpayable extension for Basic4PPC and this community here.


Quote:
EDIT: Web stuff is not my scene but I have just noticed that .NET HTTPWebRequest and HTTPWebResponse classes (as used by the HTTP library) are supposed to support SSL - how you actually do it with certificates or whatever and
The certificate stuff is not so important for my app as it is for public webservers and private web browser, because my client app does know the server and trust it :-) So i only need to create my private certificate, and i do not need a CA to approve the certificate, which makes these things easier and cheaper...:-))


Quote:
whether the Door library could do any necessary twiddling I haven't a clue!

I don't have any experience with the door lib yet, so will start to play with it soon...but i don't have a clue either if that works and how it works.


cheers

TWELVE
Reply With Quote
  #24 (permalink)  
Old 05-09-2008, 10:33 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by TWELVE View Post
I don't have any experience with the door lib yet, so will start to play with it soon...but i don't have a clue either if that works and how it works.
To use it you will have to become at least a little bit familiar with the .NET CLR and the classes it contains
Reply With Quote
  #25 (permalink)  
Old 05-09-2008, 12:15 PM
Senior Member
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 154
Default

Hello agraham,

i built in a new sub in my app, which works like this:

Code:
StringToCrypt(passwordstring,saltstring)

salt(
0) = Asc(SubString(saltstring,0,1))
salt(
1) = Asc(SubString(saltstring,1,1))
...
Return str

I then just replaced my pre-crypted passwordstring

password = "somecryptstring"

against this:


password = StringToCrypt(cleartextpassword,mysalt)


This worked fine, but left me with an rejected/invalid password.By use of my beloved network sniffer :-) i found the cause.The returned string has 3 zero bytes at the right end.Zero is not printable, so you can't see that in the msgbox ( it is just not printed).

I though about how i can solve this and came to this here:

Quote:
For i = 0 To ArrayLen(code())-1
If code(i) <> 0 Then
str = str & Chr(code(i))
End If

Next
I'm assuming, zero is not a valid content for a digit.

This works fine, but i'm asking me, why these 3 upper array fields have been created if their content equals zero...?

Is this something one could view and call as a bug in the lib...? :-))


Quote:
To use it you will have to become at least a little bit familiar with the .NET CLR and the classes it contains
I was afraid this needs to happen someday...:-)))


cheers

TWELVE

Last edited by TWELVE : 05-09-2008 at 12:17 PM.
Reply With Quote
  #26 (permalink)  
Old 05-09-2008, 01:01 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by TWELVE View Post
I'm assuming, zero is not a valid content for a digit.
This works fine, but i'm asking me, why these 3 upper array fields have been created if their content equals zero...?
Is this something one could view and call as a bug in the lib...? :-))
I've examined the output formatting routine of the Crypt source code. This function builds a "C" style string 13 characters long in a fixed length buffer of 16 characters and returns the buffer. "C" style strings are terminated by a zero, so a 13 character string is 14 characters long. That is why the zeroes are there. As a resullt of this convention a "C" string cannot contain a zero character as that would be treated as a terminator. .NET CLR strings are counted and can contain a zero. Why the writer of the original code catered for two extra characters I don't know. However as the returned string is always 13 characters long you can safely just do

For i = 0 to 12
....
Next


EDIT: If you play you may find that a .NET string containing zero doesn't display in, say, a MessageBox. This is because the MessageBox is part of the Windows OS which uses C-style strings and so the MessageBox thinks the zero is a string terminator.

Last edited by agraham : 05-09-2008 at 01:35 PM.
Reply With Quote
  #27 (permalink)  
Old 04-28-2010, 11:00 AM
Senior Member
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 154
Default

Hi Andrew,

i'm using your Crypt Lib for a long time now.I just built it in and then forgot about it because it worked as desired.

For some reason now i need to do the reverse direction, i.e. convert back the crypted string to the plain text string again.Apparently the lib already includes that method, but i don't know how to use it.There was no doc file included and i even didn't understand how the code for the string to crypt worked, i just copied most of your example code.

So, can you help out here again and give an example of the crypt to string conversion..?




regards,

TWELVE
Reply With Quote
  #28 (permalink)  
Old 04-28-2010, 11:27 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

I assume you are using the CryptDLL library. As the crypt function is actually a Cryptographic hash function it is not reversible.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #29 (permalink)  
Old 04-28-2010, 07:12 PM
Senior Member
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 154
Default

Yes, the CryptDLL you wrote some time ago on my demand.I was in the belief it would be an encryption rather than a hash.Nevertheless thx for the quick reply.

regards,

TWELVE
Reply With Quote
  #30 (permalink)  
Old 05-23-2012, 12:23 PM
Newbie
 
Join Date: May 2012
Posts: 6
Default Umlauts

Hi there,

thank you so much for this nice and useful lib! There is just one thing that I'm wondering at. Is it possible to Base64-encode german umlauts and special chars? I use your base64.decodeBtoS() for a client-server communication where the use of umlauts is indispensable. Any ideas?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On


All times are GMT. The time now is 07:10 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0