I hereby claim:
- I am jtdowney on github.
- I am jtdowney (https://keybase.io/jtdowney) on keybase.
- I have a public key whose fingerprint is 64A1 17F1 DED3 DD44 E9A2 57C9 D297 3F2A F0FB D951
To claim this, I am signing this object:
#[macro_use] | |
extern crate error_chain; | |
mod errors { | |
error_chain! { | |
foreign_links { | |
Io(::std::io::Error); | |
} | |
} | |
} |
package com.jtdowney; | |
import javax.net.ServerSocketFactory; | |
import javax.net.ssl.KeyManagerFactory; | |
import javax.net.ssl.SSLContext; | |
import javax.net.ssl.TrustManagerFactory; | |
import java.io.*; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.security.KeyStore; |
#![feature(slice_patterns)] | |
fn main() { | |
let foo: Vec<i32> = (1..10).collect(); | |
match foo.as_slice() { | |
[first, rest..] => println!("{:?} :: {:?}", first, rest), | |
[] => println!("empty"), | |
} | |
} |
I hereby claim:
To claim this, I am signing this object:
This gist describes how to use the ImageMagick and OpenSSL command line tools to encrypt an image using ECB mode.
First we need to gather some information about the original image. This will tell us what size to use in our final step.
$ identify Braintree.png
Braintree.png PNG 898x229 898x229+0+0 8-bit sRGB 65KB 0.000u 0:00.000
Looks like the image is 898x229.
Next we need to convert the image into the RGBA format. This is a simple binary format that only contains uncompressed pixel data and no meta information, like image dimensions.
package main | |
import ( | |
"bufio" | |
"fmt" | |
"io" | |
"log" | |
"net" | |
) |
require 'openssl' | |
key = OpenSSL::PKey::DSA.generate 1024 | |
puts key.to_pem | |
cert = OpenSSL::X509::Certificate.new | |
cert.version = 2 | |
cert.serial = 1 | |
cert.subject = OpenSSL::X509::Name.new [['CN', 'Test CA']] | |
cert.issuer = cert.subject |