SilverKey class
Contents
- Introduction to the Library
- Basic support package (com.kryptel.bslx)
- Kryptel API Commons package (com.kryptel)
- Cipher package (com.kryptel.cipher)
- Compressor package (com.kryptel.compressor)
- Exceptions package (com.kryptel.exceptions)
- Hash function package (com.kryptel.hash_function)
- MAC function package (com.kryptel.mac)
- Key-related functions (com.kryptel.key)
- Silver Key engine (com.kryptel.silver_key)
- Kryptel encrypted storage (com.kryptel.storage)
Declaration
package com.kryptel.silver_key; public final class SilverKey { public static boolean IsParcel(String fileName) throws IOException public static boolean IsParcel(String fileName, ParcelLocator locator) throws IOException public static boolean IsParcel(RandomAccessFile parcelFile, ParcelLocator locator) throws IOException public static boolean VerifyParcelMD5(RandomAccessFile parcelFile, ParcelLocator locator) throws Exception public static boolean VerifyParcelMD5(RandomAccessFile parcelFile, ParcelLocator locator, Object arg, IProgressCallback progressFunc, Message.Code progressMessageCode) throws Exception public static String GetStubDirectory() public static void SetStubDirectory(String stubDir) }
Description
This class contains various helper functions, mostly for locating and verifying Silver Key parcels.
IsParcel
public static boolean IsParcel(String fileName) throws IOException public static boolean IsParcel(String fileName, ParcelLocator locator) throws IOException public static boolean IsParcel(RandomAccessFile parcelFile, ParcelLocator locator) throws IOException
Analyzes the specified file and returns true if it is a Silver Key parcel. The second and the third form also fill the provided ParcelLocator structure (the locator argument remains intact if the file is not a parcel).
VerifyParcelMD5
public static boolean VerifyParcelMD5(RandomAccessFile parcelFile, ParcelLocator locator) throws Exception public static boolean VerifyParcelMD5(RandomAccessFile parcelFile, ParcelLocator locator, Object arg, IProgressCallback progressFunc, Message.Code progressMessageCode) throws Exception
Verifies parcel integrity by checking its MD5 checksum, which is stored in last 16 bytes of the parcel (see Structure of Silver Key Parcel for more info). The function returns true if the signatute is ok and false otherwise.
Checking MD5 signature is the first step of parcel verification; its purpose is to make sure that the parcel was not corrupted in transit. The parcel extractor will later check parcel HMACs to detect any tampering.
Parameters
- parcelFile
- The file to be verified.
- locator
- ParcelLocator structure filled by preceding IsParcel call.
- arg
- Argument for IProgressCallback. VerifyParcelMD5 does not use it and passes it to IProgressCallback.Callback as is.
- progressFunc
- A class implementing IProgressCallback. This argument may be null if the progress bar is not needed.
- progressMessageCode
- The code of the message that is to be shown in the progress dialog. Typically it is Message.ParcelIntegrity, which translates to the Checking parcel integrity... message (see Message class).
GetStubDirectory / SetStubDirectory
public static String GetStubDirectory() public static void SetStubDirectory(String stubDir)
Get or set the directory where decryptor stubs reside. When the engine creates a self-extracting parcel, it looks for the decryptor stub there. Stub names have form <cipher name>.stub.
The directory string must end with the separator char (/ or \). By default it is set to ./Stubs/.
See Parcel Types for more info on self-extracting parcels.