net.i2p.sam
public class SAMUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SAMUtils.InvalidDestination |
Constructor and Description |
---|
SAMUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkDestination(String dest)
Check whether a base64-encoded dest is valid
|
static void |
checkPrivateDestination(String dest) |
static void |
genRandomKey(OutputStream priv,
OutputStream pub)
Generate a random destination key
|
static Destination |
getDest(String s)
Resolve the destination from a key or a hostname
|
static Destination |
lookupHost(String name,
OutputStream pubKey)
Resolved the specified hostname.
|
static void |
main(String[] args) |
static Properties |
parseParams(StringTokenizer tok)
Parse SAM parameters, and put them into a Propetries object
|
public static void genRandomKey(OutputStream priv, OutputStream pub)
priv
- Stream used to write the private keypub
- Stream used to write the public key (may be null)public static boolean checkDestination(String dest)
dest
- The base64-encoded destination to be checkedpublic static void checkPrivateDestination(String dest) throws SAMUtils.InvalidDestination
SAMUtils.InvalidDestination
public static Destination lookupHost(String name, OutputStream pubKey)
name
- Hostname to be resolvedpubKey
- A stream to write the Destination public key (may be null)public static Destination getDest(String s) throws DataFormatException
s
- Hostname or key to be resolvedDataFormatException
public static Properties parseParams(StringTokenizer tok) throws SAMException
tok
- A StringTokenizer pointing to the SAM parametersSAMException
- if the data was formatted incorrectlypublic static void main(String[] args)