Skip to content

Instantly share code, notes, and snippets.

View techjawab's full-sized avatar

Abhishek Mitra techjawab

View GitHub Profile
public static String decrypt(String encryptedText, SecretKey secretKey, IvParameterSpec ivspec)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, secretKey, ivspec);
String decryptedString = new String(cipher.doFinal(Base64.decodeBase64(encryptedText)));
return decryptedString;
}
@techjawab
techjawab / EncryptDecrypt.java
Created July 14, 2016 07:20
Encryption logic
public static String encrypt(String plainText, SecretKey secretKey, IvParameterSpec ivspec)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
byte[] plainTextByte = plainText.getBytes();
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivspec);
String encryptedString = Base64.encodeBase64String(cipher.doFinal(plainTextByte));
return encryptedString;
}
@techjawab
techjawab / EncryptDecrypt.java
Created July 14, 2016 07:19
Key definitions for encryption / decryption
private static String key = "WWWT3chJ@WAB.60M";
private static final SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(), "AES");
private static final byte[] iv = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
server {
listen 80;
server_name 192.168.2,2;
return 301 https://$server_name$request_uri; # enforce https
}
server {
listen 443 ssl;
server_name 192.168.2.2;
{
"alt-speed-down": 15,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 15,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name technet.example.com;
return 301 https://$server_name$request_uri; # enforce https
}
<body>
<ul id="navlist">
<li id="albanian" title="Albanian"><a href="http://translate.google.com/translate?hl=en&langpair=en|sq&u=www.techjawab.com/"></a></li>
<li id="arabic" title="Arabic"><a href="http://translate.google.com/translate?hl=en&langpair=en|ar&u=www.techjawab.com/"></a></li>
<li id="bulgarian" title="Bulgarian"><a href="http://translate.google.com/translate?hl=en&langpair=en|bg&u=www.techjawab.com/"></a></li>
<li id="catalan" title="Catalan"><a href="http://translate.google.com/translate?hl=en&langpair=en|ca&u=www.techjawab.com/"></a></li>
<li id="ch_simp" title="Chinese Simplified"><a href="http://translate.google.com/translate?hl=en&langpair=en|zh-CN&u=www.techjawab.com/"></a></li>
<li id="ch_trad" title="Chinese Traditional"><a href="http://translate.google.com/translate?hl=en&langpair=en|zh-TW&u=www.techjawab.com/"></a></li>
...
<style>
#navlist {
position: relative;
}
#navlist li {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
server {
listen 80;
server_name 192.168.XXX.XXX;
rewrite ^ https://$server_name$request_uri? permanent; # enforce https
}
server {
listen 443 ssl;
server_name 192.168.XXX.XXX;
ssl_certificate /etc/nginx/cert.pem;
<div id="displaybox"></div>
<script>
var $displaybox1 = $jq191( "#displaybox" );
$displaybox1.append( "Printed using jQuery version ($): " + $jq191.fn.jquery + "<br>" );
var $displaybox2 = $jq162( "#displaybox" );
$displaybox2.append( "Printed using jQuery version ($): " + $jq162.fn.jquery + "<br>" );
</script>