Showing posts with label Security. Show all posts
Showing posts with label Security. Show all posts

Code to return random salt characters using java

The salt is a sequence of characters / bytes which is added to the password before getting digested by message digest algorithm, such as MD5 or SHA . It is better to send salted hash rather than sending encrypted the password alone . This protects against Brute Force attacks . Salt may be fixed or variable . In fixed salt , everytime the same charaters are used for digesting every password which is not more safe. In variable salt, different characters (Random) are used for each password being digested which is more secured. Now let us see how random salt is generated. For that we have to define a set of characters as a Salt. From these characters , we have to pick some number of chars (in our example it is 1 to 9 random number is generated between 1 to 9 ) randomly which will be a variable salt. The following code returns random salt characters between 1 to 9 .

import java.util.*;
class RandomSaltChars
{
public static void main(String args[])
{
String chars_salt = "1234567890abcdefghijklABCDEFGHIJKLMNOPQRSTUVWXYZmnopqrstuvwxyz";
StringBuffer random_salt = new StringBuffer();
Random rnd = new Random();
int noc = rnd.nextInt(9) + 1;
//returns a random 9 chars salt
while (random_salt.length() < noc) {
int index = (int) (rnd.nextFloat() *chars_salt.length());
random_salt.append(chars_salt.charAt( index));
}

System.out.println("salt characters : " + random_salt);
}
}


Output of the program:

Read more...

Rules for Strong Password to avoid brute force attacks | Complexity Password Policy

Any application using authentication should enforce password complexity policy in order to prevent an attacker / hacker from easily guessing them which makes the application vulnerable to brute force attacks .

So we have to design a password policy by imposing certain rules on the password. Eventhough there is no fixed rules to design a password , atleast we should follow the following rules sothat the application should be safe from brute force attacks.
The password must meet the following criteria
1. Password must be minimum 8 characters.
2. Password must contain characters from of the following 4 categories
a). At least one upper case letter: (A – Z)
b). At least one lower case letter: (a - z)
c). At least one number: (0 - 9)
d) . At least one Special Characters of !@#$%&*()
4. Password cannot contain the user ID
5. Password history may be maintained in order not to use the same password again . Atleast 4 unique new passwords must be issued before an old password can be reused.
6. Account may be locked out after the 3 number of unsuccessful attempts

Eg. Passwords using the above rules 1) J6agru@F 2) jdU(g4aK2

Password complexity policies are designed to deter brute force attacks by increasing the number of possible passwords. When password complexity policy is enforced, new passwords must meet the following guidelines


Read more...

What is phishing ? with Example


Phishing is a fraudulent attempt, usually made through email, SMS or phone calls seeking your personal and confidential information like username , Passwords and Credit Card Details .

For Example , Bank Customers may receive fake / misleading emails (known as Phishing) apparently emanating from bank's email-id stating that the customers account has been chosen for verification purpose and customers are requested to update their account information like User Id, Password , Card Number , etc. by clicking on the linke provided in the e-mail .

If you click on the link , it will take to a web page which is hosted in different web server which similar to Bank's website.After the information is submitted by the customer , it will redirect to the Bank's website.



Phishing attacks usually come from email messages that attempt to lure the recipient into updating their personal information on fake, but very real looking, Web sites.
Read more...

How to make SSH Connection from Windows to Linux ?

Making secure connections between Linux to Linux is very easy by using the inbulit command (SSH) . eg. $ssh root@192.168.79.128 where 192.168.79.128 is the IP address of the destination linux system.

For making Secure Shell(SSH) connections between Windows to Linux , we can use the free utility Putty which is freely availabe from http://www.putty.nl/download.html . Now let us see how to use putty. Run the putty.exe , a window will open as follows.


The following steps should be followed.
1) Give Hostname or IP Address of the Linux Machine in the Hostname textbox .
2) Select the option SSH which will display the port 22 ( SSH will use the port 22)
3) You can save this session for future access by giving the name in the text box of the saved sessions.
4) Click on the Open button which will ask the username and password.

Now the connection between windows & linux is secured.
Read more...

Installing SSL (Security Certificate) in Mozilla Firefox

The following instructions will guide you how to install security Certificate in Mozilla Firefox which is an open source and most popular web browser.

Such certificates are widely used for encrypting your information which you are sending so that the right person can read the message OR encrypted message can be read only by the right person who has the key. For eg a person can send any personal identification in online banking systems.



Installing Security Certificate in Mozilla Firefox

1) Select Options in the Tool menu as follows . Tools -> Options.



2) The following screen appears. In that screen select advanced options which displays as follows.




3) Click on the View Certificates which will display the following screen.



4) Click on the import button which will display the dialog box. Select the Security Certificate and click OK. Now the certificate is installed.
Read more...

 
Copyright 2011 Java Online