public abstract class Key extends java.lang.Object implements WritableToDataOutputStream, java.lang.Comparable<Key>
Modifier and Type | Field and Description |
---|---|
static byte |
ALGO_AES_CTR_256_SHA256 |
static byte |
ALGO_AES_PCFB_256_SHA256
Code for 256-bit AES with PCFB and SHA-256
|
VERSION
Modifier | Constructor and Description |
---|---|
protected |
Key(byte[] routingKey) |
protected |
Key(Key key) |
Modifier and Type | Method and Description |
---|---|
abstract Key |
archivalCopy()
Get a copy of the key with any unnecessary information stripped, for long-term
in-memory storage.
|
abstract Key |
cloneKey() |
static freenet.keys.Key.Compressed |
compress(Bucket sourceData,
boolean dontCompress,
short alreadyCompressedCodec,
long sourceLength,
long MAX_LENGTH_BEFORE_COMPRESSION,
int MAX_COMPRESSED_DATA_LENGTH,
boolean shortLength,
java.lang.String compressordescriptor)
Compress data.
|
static KeyBlock |
createBlock(short keyType,
byte[] keyBytes,
byte[] headersBytes,
byte[] dataBytes,
byte[] pubkeyBytes) |
static ClientKeyBlock |
createKeyBlock(ClientKey key,
KeyBlock block) |
boolean |
equals(java.lang.Object o) |
abstract byte[] |
getFullKey()
Get the full key, including any crypto type bytes, everything needed to construct a Key object
|
byte[] |
getKeyBytes() |
byte[] |
getRoutingKey() |
abstract short |
getType()
Get key type
High 8 bit ((type >> 8) & 0xFF) is the base type (
NodeCHK.BASE_TYPE or
NodeSSK.BASE_TYPE ). |
int |
hashCode() |
static boolean |
isValidCryptoAlgorithm(byte cryptoAlgorithm) |
static Key |
read(java.io.DataInput raf)
Read a Key from a RandomAccessFile
|
double |
toNormalizedDouble()
Convert the key to a double between 0.0 and 1.0.
|
abstract void |
write(java.io.DataOutput _index)
Write to disk.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
writeToDataOutputStream
public static final byte ALGO_AES_PCFB_256_SHA256
public static final byte ALGO_AES_CTR_256_SHA256
protected Key(byte[] routingKey)
protected Key(Key key)
public abstract Key cloneKey()
public abstract void write(java.io.DataOutput _index) throws java.io.IOException
_index
- java.io.IOException
public static Key read(java.io.DataInput raf) throws java.io.IOException
raf
- The file to read from.java.io.IOException
public static KeyBlock createBlock(short keyType, byte[] keyBytes, byte[] headersBytes, byte[] dataBytes, byte[] pubkeyBytes) throws KeyVerifyException
KeyVerifyException
public double toNormalizedDouble()
public abstract short getType()
NodeCHK.BASE_TYPE
or
NodeSSK.BASE_TYPE
).
ALGO_AES_PCFB_256_SHA256
is supported).
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public static freenet.keys.Key.Compressed compress(Bucket sourceData, boolean dontCompress, short alreadyCompressedCodec, long sourceLength, long MAX_LENGTH_BEFORE_COMPRESSION, int MAX_COMPRESSED_DATA_LENGTH, boolean shortLength, java.lang.String compressordescriptor) throws KeyEncodeException, java.io.IOException, InvalidCompressionCodecException
sourceData
- dontCompress
- alreadyCompressedCodec
- sourceLength
- MAX_LENGTH_BEFORE_COMPRESSION
- MAX_COMPRESSED_DATA_LENGTH
- shortLength
- compressordescriptor
- KeyEncodeException
java.io.IOException
InvalidCompressionCodecException
public byte[] getRoutingKey()
public byte[] getKeyBytes()
public static ClientKeyBlock createKeyBlock(ClientKey key, KeyBlock block) throws KeyVerifyException
KeyVerifyException
public abstract byte[] getFullKey()
public abstract Key archivalCopy()
public static boolean isValidCryptoAlgorithm(byte cryptoAlgorithm)