Loading…

Kryptel/Java

BinaryKeyFile class

Declaration

package com.kryptel.key;

public class BinaryKeyFile {

    public static final long NO_TIMESTAMP           = -1;
    public static final long CURRENT_TIMESTAMP      = 0;

    public BinaryKeyFile(String filePath) throws Exception;
    public BinaryKeyFile(long time, String comment) throws Exception;

    public UUID GetKeyID();
    public byte [] GetKeyData();
    public long GetKeyTimestamp();
    public String GetKeyComment();

    public void Save(String filePath) throws Exception;
}

Description

This simple class encapsulates Kryptel key file.

Constructor BinaryKeyFile(String filePath)

public BinaryKeyFile(String filePath) throws Exception;

Loads a binary key from the specified file.

Constructor BinaryKeyFile(long time, String comment)

public BinaryKeyFile(long time, String comment) throws Exception;

Generates a new random binary key.

time
Set the key creation time to the specified value (milliseconds since 1970). The special value CURRENT_TIMESTAMP assigns the current system time; NO_TIMESTAMP creates a key with no timestamp assigned.
comment
Attaches a text description to the created key. This value may be null, which means no description. If the time argument is set to NO_TIMESTAMP, then this argument must be null.

GetKeyID

public UUID GetKeyID()

Returns the unique key ID. The new versions Kryptel 8+ or Silver Key 5+ completely ignore this ID.

GetKeyData

public byte [] GetKeyData()

Returns 512-byte long binary key.

GetKeyTimestamp

public long GetKeyTimestamp()

Returns the timestamp (milliseconds since 1970) associated with the key or NO_TIMESTAMP.

GetKeyComment

public String GetKeyComment()

Returns the text description associated with the key file or null if none.

Save

public void Save(String filePath) throws Exception;

Saves the binary key to the specified file (it is strongly recommended to use the standard .kf file extension).