public class SessionConfig extends DataStructureImpl
| Modifier and Type | Field and Description |
|---|---|
static String |
PROP_OFFLINE_EXPIRATION
Seconds since epoch, NOT ms
|
static String |
PROP_OFFLINE_SIGNATURE
Base 64, optionally preceded by sig type and ':', default DSA-SHA1
|
static String |
PROP_TRANSIENT_KEY
Base 64, optionally preceded by sig type and ':', default DSA-SHA1
|
| Constructor and Description |
|---|
SessionConfig() |
SessionConfig(Destination dest) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object object) |
Date |
getCreationDate()
Determine when this session was authorized by the destination (so we can
prevent replay attacks)
|
Destination |
getDestination()
Retrieve the destination for which this session is supposed to connect
|
long |
getOfflineExpiration()
Get the offline expiration
|
Signature |
getOfflineSignature()
Gets the offline signature from the options.
|
Properties |
getOptions()
Retrieve any configuration options for the session
|
Signature |
getSignature() |
SigningPublicKey |
getTransientSigningPublicKey()
Gets the transient signing public key for offline signing.
|
int |
hashCode() |
void |
readBytes(InputStream rawConfig)
Load up the current object with data from the given stream.
|
void |
setCreationDate(Date date) |
void |
setOfflineSignature(long expires,
SigningPublicKey transientSPK,
Signature offlineSig)
Set the offline signing data.
|
void |
setOptions(Properties options)
Configure the session with the given options;
keys and values 255 bytes (not chars) max each
Defaults in SessionConfig options are, in general, NOT honored.
|
void |
setSignature(Signature sig) |
void |
signSessionConfig(SigningPrivateKey signingKey)
Sign the structure using the supplied private key
|
boolean |
tooOld()
Misnamed, could be too old or too far in the future.
|
String |
toString() |
boolean |
verifySignature()
Verify that the signature matches the destination's signing public key.
|
void |
writeBytes(OutputStream out)
Write out the data structure to the stream, using the format defined in the
I2P data structure specification.
|
calculateHash, fromBase64, fromByteArray, read, toBase64, toByteArraypublic static final String PROP_OFFLINE_EXPIRATION
public static final String PROP_OFFLINE_SIGNATURE
public static final String PROP_TRANSIENT_KEY
public SessionConfig()
public SessionConfig(Destination dest)
public Date getCreationDate()
public Destination getDestination()
public long getOfflineExpiration()
public Signature getOfflineSignature()
public Properties getOptions()
public Signature getSignature()
public SigningPublicKey getTransientSigningPublicKey()
public void readBytes(InputStream rawConfig) throws DataFormatException, IOException
DataStructurerawConfig - stream to read fromDataFormatException - if the data is improperly formattedIOException - if there was a problem reading the streampublic void setCreationDate(Date date)
public void setOfflineSignature(long expires,
SigningPublicKey transientSPK,
Signature offlineSig)
IllegalStateException - if options are not setpublic void setOptions(Properties options)
options - Properties for this sessionpublic void setSignature(Signature sig)
public void signSessionConfig(SigningPrivateKey signingKey) throws DataFormatException
signingKey - SigningPrivateKey to sign with.
If offline data is set, must be with the transient key.DataFormatException - if the data cannot be signedpublic boolean tooOld()
public boolean verifySignature()
public void writeBytes(OutputStream out) throws DataFormatException, IOException
DataStructureout - stream to write toDataFormatException - if the data was incomplete or not yet ready to be writtenIOException - if there was a problem writing to the stream