3 # usage: onetimekey path/to/mycert.pem
5 # Takes an openssl cert+key pem file and turns into a long string
6 # for the x11vnc SSL VNC Java Viewer.
8 # The Java applet URL parameter can be oneTimeKey=<str> where str is
9 # the output of this program, or can be oneTimeKey=PROMPT in which
10 # case the applet will ask you to paste in the string.
12 # The problem trying to be solved here is it is difficult to get
13 # the Java applet to have or use a keystore with the key saved
14 # in it. Also, as the name implies, an HTTPS server can create
15 # a one time key to send to the applet (the user has already
16 # logged in via password to the HTTPS server).
23 openssl pkcs8 -topk8 -nocrypt -in "$in" -out "$der" -outform der
25 pbinhex=/tmp/pbinhex.$$
33 \$str .= sprintf("%02x", unpack("C", \$c));
41 str1=`$pbinhex < "$der"`
44 n=`grep -n 'BEGIN CERTIFICATE' $in | awk -F: '{print $1}' | head -1`
45 str2=`tail +$n $in | $pbinhex`