class SAMUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
COMMAND |
static String |
OPCODE |
Constructor and Description |
---|
SAMUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkPrivateDestination(String dest)
Check whether a base64-encoded {dest,privkey,signingprivkey} is valid
|
static void |
genRandomKey(OutputStream priv,
OutputStream pub)
Generate a random destination key using DSA_SHA1 signature type.
|
static void |
genRandomKey(OutputStream priv,
OutputStream pub,
SigType sigType)
Generate a random destination key.
|
static Destination |
getDest(String s)
Resolve the destination from a key or a hostname
|
static Properties |
parseParams(String args)
Parse SAM parameters, and put them into a Propetries object
Modified from EepGet.
|
public static final String COMMAND
public static final String OPCODE
public static void genRandomKey(OutputStream priv, OutputStream pub)
priv
- Stream used to write the destination and private keyspub
- Stream used to write the destination (may be null)public static void genRandomKey(OutputStream priv, OutputStream pub, SigType sigType)
priv
- Stream used to write the destination and private keyspub
- Stream used to write the destination (may be null)sigType
- what signature typepublic static boolean checkPrivateDestination(String dest)
dest
- The base64-encoded destination and keys to be checked (same format as PrivateKeyFile)public static Destination getDest(String s) throws DataFormatException
s
- Hostname or key to be resolvedDataFormatException
- on bad Base 64 or name not foundpublic static Properties parseParams(String args) throws SAMException
COMMAND COMMAND OPCODE COMMAND OPCODE [key=val]... COMMAND OPCODE [key=" val with spaces "]... PING PONG PING any thing goes PONG any thing goes Escaping is allowed with a backslash, e.g. \" No spaces before or after '=' allowed Keys may not be quoted COMMAND, OPCODE, and keys may not have '=' or whitespace unless escaped Duplicate keys not allowedA key without a value is not allowed by the spec, but is returned with the value "true". COMMAND is returned as the value of the key ""COMMAND"". OPCODE, or the remainder of the PING/PONG line if any, is returned as the value of the key ""OPCODE"".
args
- non-nullSAMException
- on some errors but not all