Hi all, Hi Alistair! * Young, Alistair wrote on Fri, Feb 06, 2009 at 10:16 +0000: > Ultimately I settled on the use of a shell script to act as an > intermediary: > > #!/bin/bash
If you can use bash you could pass the key in \xNN form for $'\xNN' to avoid special characters like blanks and control chars or binary zero issues: pass a kind of hey dump instead of binary. First make some "escape hex dump" with something like public static char[] getbin(byte[] buf) { char[] result = null; int pos = 0; int len = buf.length; { String result = ""; result = new char [len * 2]; for (int i = 0; i < len; i++) { byte b = buf[pos + i]; // this is horrible slow because of many temp StringBuffers, // just to illustrate result = result + "\\x"; // we want \x in the String result = result + hexnib((b & 0xF0) >> 4); result = result + = hexnib((b & 0x0F)); } } return result; } public static final char hexnib(int nibble) { if (nibble <= 9) return (char) ('0' + nibble); return (char) ('A' + nibble - 10); } For 'hello' you should get '\x68\x65\x6c\x6c\x6f'. Then pass this to your script as parameter like you now pass the file name and in your script have something like #!/bin/bash key_escaped="$1" key_raw=`eval echo $\'$key_escaped\'` echo openssl -option "$key_raw" which can be used like u...@host:~ $ ./x.sh '\x41\x42' openssl -option "AB" (This does not mean that I'd recommend to do such things! Crypto via shell scripts and stuff invitest potential security flaws etc.) oki, Steffen ----[End of message]------------------------------------------------->8======= -- About Ingenico: Ingenico is the world's leading provider of payment solutions, with over 15 million terminals deployed across the globe. Delivering the very latest secure electronic payment technologies, transaction management and the widest range of value added services, Ingenico is shaping the future direction of the payment solutions market. Leveraging on its global presence and local expertise, Ingenico is reinforcing its leadership by taking banks and businesses beyond payment through offering comprehensive solutions, a true source of differentiation and new revenues streams. This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. P Please consider the environment before printing this e-mail ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org