Posts about ssl

AES encryption in Ruby and Decryption in Java

24 February 2015
This one is precious, as it took me a long time to figure out. As a side-note, Java apparently only supports 128bit AES.

Here's the Ruby code:

def encrypt(string, pwd)
    salt = OpenSSL::Random.random_bytes(16)

    # prepare cipher for encryption
    e ='AES-128-CBC')

    # next, generate a PKCS5-based string for your key + initialization vector
    key_iv = OpenSSL::PKCS5.pbkdf2_hmac_sha1(pwd, salt, 1024, e.key_len+e.iv_len)
    key = key_iv[0, e...

Avoiding SSL redirect loop

26 January 2015
If you are configuring an nginx website to use SSL and - by any chance - you need to setup more than one “server” entry (for instance to make www redirect to the plain URL), keep in mind that you need to declare the ssl certificate mumbo-jumbo in both entries, otherwise browsers will enter a redirect loop.

Something like the following will do:

server {
        listen 443 ssl;

        include zenblast-ssl.conf;

        return 301 $scheme://$request_uri;...
Displaying all 2 posts