Previous Topic, In this tutorial we will learn password Encryption and Decryption techniques in selenium webdriver, its implementation and advantage in selenium script.
Whats is Password Encryption and Decryption?
Password Encryption and Decryption is selenium web driver is a technique in selenium , of encrypting the password or the user credentials so that it cannot be read by unauthorized individual from directly accessing it or in other words encryption of data is binded in such way that different individual or unauthorized person cannot understand it in simple text .
Similarly Decryption data is the technique to decrypt or converting of data in the text so that the computer can understand the data along with the individual.
How to achieve encryption and decryption in automation script ?
Encryption and Decryption of a String or any other text can be performed in java using Base64 Class, which is part of java.util package and contains method from encryption and decryption of data.
Lets understand encryption more by coding:
package SeleniumArchitecture;
import java.util.Base64;
public class EncrptionAndDecryption {
public static void main(String[] args) {
String encrptData= "Password";
byte[] encodedBytes = Base64.getEncoder().encode(encrptData.getBytes());
System.out.println("encodedBytes --------------->" + new String(encodedBytes));
}
}
Code in Eclipse along with Output:
Lets understand Decryption more by coding:
package SeleniumArchitecture;
import java.util.Base64;
public class EncrptionAndDecryption {
public static void main(String[] args) {
//String encrptData= "Password";
String decrptData ="UGFzc3dvcmQ=";
byte[] decodeBytes = Base64.getDecoder().decode(decrptData.getBytes());
System.out.println("decodedBytes --------------->" + new String(decodeBytes));
}
}
Above tutorials we understand How Encryption and Decryption in selenium works, the encryption and decryption on a string using base64 class.
Facebook-> https://www.facebook.com/code2test/?modal=admin_todo_tour