Following is the code from my code file. Its a implementation of RSA
Algorithm(Java wont provide u any such algo but provide u
all the facilities to install ur own provider). Its a open Java source utility &
its really cooool.
Rest is upto you. If u need any more help than feel free to ask..
Good Luck & keep smiling :)
For Key Generation:
KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA", "Cryptix");
SecureRandom random = new SecureRandom();
keygen.initialize(bit, random);
KeyPair keypair = keygen.generateKeyPair();
//////////////////////////////////////////////////////////////////////////////////
public static byte[] Crypt(byte [] data, CryptixRSAPublicKey pub_key){
RawRSACipher raw = new RawRSACipher();
try{
raw.initEncrypt(pub_key);
byte[] Cryp = raw.crypt(data);
return Cryp;
} catch(Exception err) {
System.out.println("Crypt Error " + err.getMessage());
return null;
}
} //end of Crypt
////////////////////////////////////////////////////////////////////////////////////
public static byte[] DeCrypt(byte [] data, CryptixRSAPrivateKey pvt_key){
RawRSACipher raw = new RawRSACipher();
try{
raw.initDecrypt(pvt_key);
byte[] DeCryp = raw.crypt(data);
return DeCryp;
} catch(Exception err) {
System.out.println("DeCrypt Error " + err.getMessage());
return null;
}
} //end of DeCrypt
////////////////////////////////////////////////////////////////////////////////////
Regards,
Muzammil Sajjad
Arul <[EMAIL PROTECTED]> on 02/13/2001 03:04:09 PM
Please respond to Arul <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Muzammil Sajjad/CresSoft)
Subject: Re: Encryption
Thanx Harish
But could u plzz send me some codes..
Arul
----- Original Message -----
From: "harishrp" <[EMAIL PROTECTED]>
To: "Arul" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, February 13, 2001 3:32 PM
Subject: Re: Encryption
> Use the MessageDigest 5 class available under java.security.MessageDigest
> package.
> MessageDigest class provides applications the functionality of a message
digest
> algorithm, such as MD5 or SHA. Message digests are secure one-way hash
functions
> that take arbitrary-sized data and output a fixed-length hash value.
>
> Harish
>
> Arul wrote:
>
> > Hi Guys...
> >
> > Could any body tell me how to encrypt the password and save it in a
> > database..
> >
> > Say my scenario goes like this...I write a login component in EJB and
that
> > checks whther the username and password is correct and based on the
login
> > name it gives the login permission.
> >
> > but before that when i save the user information , i should encrypt his
> > password and save it in the datbase...It should be a irreversible
> > encryption.
> >
> > When ever my component validates the username and password ,it shuld
encrypt
> > the passwrd and check for it ...
> >
> > Any ideas...
> >
> > Arul
> >
> >
===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> > of the message "signoff EJB-INTEREST". For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".