BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-02-2011, 03:51 AM   #1
admireravi
New Member
 
Join Date: Sep 2011
Model: none
PIN: N/A
Carrier: AIRTEL
Posts: 2
Question Encryption using SHA1 of User ID and Password

Please Login to Remove!

I am creating a blackberry application which sends the request to the server. So authentication of the user is required here. So for doing this i want to hash UserID and password using SHA1 in blackberry. The hashed data is encoded and then passed to the server for authentication.
My problem is how do i implement this. Can someone give the sample code for implementing this in blackberry.
Thanks

Last edited by admireravi; 10-02-2011 at 04:04 AM..
Offline  
Old 10-02-2011, 06:21 AM   #2
dc/dc
Spam Reporter
 
dc/dc's Avatar
 
Join Date: Oct 2005
Location: IAD
Model: 6230
Carrier: Voicestream
Posts: 14,524
Default Re: Encryption using SHA1 of User ID and Password

You need to post in the Developer section.
__________________
I h8 txtspk.
Offline  
Old 10-02-2011, 08:09 AM   #3
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default Re: Encryption using SHA1 of User ID and Password

Code:
String userid, password;
...
SHA1Digest sha1 = new SHA1Digest();

sha1.update(userid.getBytes(), 0, userid.length());
byte[] userHash = new byte[sha1.getBlockLength()];
sha1.getDigest(userHash, 0, true);

sha1.update(password.getBytes(), 0, password.length());
byte[] passHash = new byte[sha1.getBlockLength()];
sha1.getDigest(passHash, 0, true);
__________________
My other Blackberry is a PlayBook.
Offline  
Old 10-02-2011, 11:25 AM   #4
Dubdub
Appleinator
 
Dubdub's Avatar
 
Join Date: Nov 2005
Location: New Hampshire
Model: App6+
OS: AJBR549
PIN: Ask
Carrier: ATT & Verizon
Posts: 20,038
Default Re: Encryption using SHA1 of User ID and Password

Moved to the Developer Forum.
__________________
-->>BB FAQ

-->>Stinsonddog's Tip Site!

-->>Twitter


If someone helps, tell them by clicking the Thanks button.!!
Offline  
Closed Thread



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


PD-9A Polarity Checker Phase Detector Self-Test Auto-Off Audio Speaker Testing picture

PD-9A Polarity Checker Phase Detector Self-Test Auto-Off Audio Speaker Testing

$45.00



Audio Polarity Checker Phase Detector Self-Test Auto-Off PD-9A Speaker Tester picture

Audio Polarity Checker Phase Detector Self-Test Auto-Off PD-9A Speaker Tester

$43.00



IndusTec Motor polarity reversing - Toggle Switch 3 Pos DPDT Momentary 12V 24V picture

IndusTec Motor polarity reversing - Toggle Switch 3 Pos DPDT Momentary 12V 24V

$14.99



Allen Bradley 937ZH-DPBN-2 Intrinsic Safety Zener Barrier, Positive Polarity DC picture

Allen Bradley 937ZH-DPBN-2 Intrinsic Safety Zener Barrier, Positive Polarity DC

$139.99



Honeywell Quartz Polarity Sensitive Hour Meter 85098 picture

Honeywell Quartz Polarity Sensitive Hour Meter 85098

$79.99



Polarity Relay fits Belarus 570 572 902 802 922 562 825 560 822 820 805 800 905 picture

Polarity Relay fits Belarus 570 572 902 802 922 562 825 560 822 820 805 800 905

$164.49







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.