public class ClientCHK extends ClientKey implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static short |
CRYPTO_KEY_LENGTH
The length of the decryption key
|
static short |
EXTRA_LENGTH
The length of the "extra" bytes in the key
|
static ClientCHK |
TEST_KEY
Useful for e.g.
|
Modifier | Constructor and Description |
---|---|
protected |
ClientCHK() |
|
ClientCHK(byte[] routingKey,
byte[] encKey,
boolean isControlDocument,
byte algo,
short compressionAlgorithm) |
|
ClientCHK(byte[] routingKey,
byte[] encKey,
byte[] extra) |
|
ClientCHK(java.io.DataInputStream dis)
Create from a raw binary CHK.
|
|
ClientCHK(FreenetURI uri)
Create from a URI.
|
Modifier and Type | Method and Description |
---|---|
ClientCHK |
cloneKey() |
boolean |
equals(java.lang.Object o) |
byte |
getCryptoAlgorithm() |
static byte |
getCryptoAlgorithmFromExtra(byte[] extra) |
byte[] |
getCryptoKey() |
byte[] |
getExtra() |
static byte[] |
getExtra(byte cryptoAlgorithm,
short compressionAlgorithm,
boolean controlDocument) |
NodeCHK |
getNodeCHK() |
Key |
getNodeKey(boolean cloneKey) |
byte[] |
getRoutingKey() |
FreenetURI |
getURI() |
int |
hashCode() |
static byte[] |
internExtra(byte[] extra) |
boolean |
isCompressed() |
boolean |
isMetadata() |
static ClientCHK |
readRawBinaryKey(java.io.DataInputStream dis)
Read a raw binary CHK.
|
java.lang.String |
toString() |
void |
writeRawBinaryKey(java.io.DataOutputStream dos)
Write an ultra-compact representation.
|
getNodeKey
getBaseKey
public static final short EXTRA_LENGTH
public static final short CRYPTO_KEY_LENGTH
public static final ClientCHK TEST_KEY
public ClientCHK(byte[] routingKey, byte[] encKey, boolean isControlDocument, byte algo, short compressionAlgorithm)
routingKey
- The routing key. This is the overall hash of the
header and content of the key.encKey
- The decryption key. This is not passed to other nodes
and is extracted from the URI.isCompressed
- True if the data was gzipped before encoding.isControlDocument
- True if the document is a Control Document.
These carry metadata, whereas ordinary keys carry data, and have no
type.algo
- The encryption algorithm's identifier. See ALGO_* for
values.public ClientCHK(byte[] routingKey, byte[] encKey, byte[] extra) throws java.net.MalformedURLException
java.net.MalformedURLException
public ClientCHK(FreenetURI uri) throws java.net.MalformedURLException
java.net.MalformedURLException
public ClientCHK(java.io.DataInputStream dis) throws java.io.IOException
java.io.IOException
protected ClientCHK()
public void writeRawBinaryKey(java.io.DataOutputStream dos) throws java.io.IOException
java.io.IOException
- If a write failed.public byte[] getExtra()
public static byte[] getExtra(byte cryptoAlgorithm, short compressionAlgorithm, boolean controlDocument)
public static byte getCryptoAlgorithmFromExtra(byte[] extra)
public static byte[] internExtra(byte[] extra)
public java.lang.String toString()
toString
in class java.lang.Object
public Key getNodeKey(boolean cloneKey)
getNodeKey
in class ClientKey
public NodeCHK getNodeCHK()
public FreenetURI getURI()
getURI
in class BaseClientKey
public static ClientCHK readRawBinaryKey(java.io.DataInputStream dis) throws java.io.IOException
java.io.IOException
public boolean isMetadata()
public boolean isCompressed()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public byte[] getRoutingKey()
public byte[] getCryptoKey()
public byte getCryptoAlgorithm()