Loading…

Kryptel/Java

ISilverKeyParcel interface

Declaration

package com.kryptel.silver_key;

public interface ISilverKeyParcel {
  enum PARCEL_TYPE { STUB, STUBLESS, APPEND };

  void SetParcelTitle(String title) throws Exception;
  void AttachDescription(String description) throws Exception;

  ISilverKeyStream Create(String fileName, PARCEL_TYPE type, IKryptelComponent cipher,
                          Object arg, IKeyCallback keyFunc,
                          IProgressCallback progressFunc) throws Exception;

  ISilverKeyStream Create(IDataSink sink, Object sinkArg,
                          String fileName, PARCEL_TYPE type, IKryptelComponent cipher,
                          Object arg, IKeyCallback keyFunc,
                          IProgressCallback progressFunc) throws Exception;

  void Close() throws Exception;
}

Description

ISilverKeyParcel and its supplementary interface ISilverKeyStream are used for parcel creation.

PARCEL_TYPE

enum PARCEL_TYPE { STUB, STUBLESS, APPEND };

Specifies the type of the parcel being created. See Parcel Types for a detailed discussion.

STUB
The parcel is self-extracting and will include a decryptor stub.
STUBLESS
The parcel is standard one with no pre-header data.
APPEND
The parcel is hidden; it should be attached to the specified file. The original file will be saved with the .BAK extension.

SetParcelTitle

void SetParcelTitle(String title) throws Exception;

Sets a parcel title. The title will be shown in all parcel-related dialogs, for example, Enter password for My Secret Data Parcel. If the title is not set, the default title Silver Key parcel is used. This function must be called before the Create function.

AttachDescription

void AttachDescription(String description) throws Exception;

Adds an unencrypted description, which will be shown before actual parcel decryption. This function must be called before the Create function.

ISilverKeyStream Create(String fileName, PARCEL_TYPE type, IKryptelComponent cipher,
                        Object arg, IKeyCallback keyFunc,
                        IProgressCallback progressFunc) throws Exception;

ISilverKeyStream Create(IDataSink sink, Object sinkArg,
                        String fileName, PARCEL_TYPE type, IKryptelComponent cipher,
                        Object arg, IKeyCallback keyFunc,
                        IProgressCallback progressFunc) throws Exception;

Initializes the engine and creates the parcel stream (ISilverKeyStream). Note that actual data writing will occur when the Close function is called.

Silver Key engine creates parcel in one pass, so the parcel may be immediately uploaded (or written to any sequential device) without writing to an intermediary file. Just create an appropriate IDataSink class for output and use the second from of the Create function.

sink
Data sink interface to output the parcel. Must not be null.
sinkArg
An argument for the datasink's Init method. The engine does not use this object, just passes it to the data sink. It usually represents the execution context, or null is the operation is context-independent.
fileName
Depending on the parcel type it is either the name of the output file (if PARCEL_TYPE != APPEND) or the name of the file the parcel is to be attached to (if PARCEL_TYPE == APPEND). Note that the second form of the function does not output data to a file so it ignores this argument for a non-hidden parcel.
If PARCEL_TYPE != APPEND and the first form of the function is used (in other words, if the parcel is not hidden and goes to the specified file), and if a file with such name already exists, the file will be quietly replaced.
type
The parcel type. See the discussion of PARCEL_TYPE above.
cipher
IKryptelComponent of the cipher to be used for encryption. The cipher must be properly initialized, i.e. the encryption key is set and so on. Must not be null.
arg
An argument for keyFunc and progressFunc.
keyFunc
IKeyCallback pointer, must not be null.
progressFunc
IProgressCallback, may be null.

Close

void Close() throws Exception;

Finalize the parcel and write it away.