|
SafeAPI v1.20 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.safeapi.CryptoCommon
com.safeapi.CryptoAsym
Asymmetric Cryptography APIs Module
Constructor Summary | |
CryptoAsym()
Loads an instance of CryptoAsym. |
Method Summary | |
boolean |
addRecipient(String sListName,
String sKeyID)
Adds a new recipient to the list. |
void |
createRecipients(String sListName)
Creates a new recipient list for RSA file encryption. |
void |
createRecipientsTune(String sListName,
int nInitialCapacity,
int nCapacityIncrement)
Create a new recipient list for RSA file encryption. |
int |
decryptAndVerify(String sKeyID,
char[] caPassphrase,
String sSignKeyId,
String sInputPath,
String sOutputPath)
Decrypts a file with an asymmetric cipher for the specified secret key and verify signature |
byte[] |
decryptBuffer(String sKeyID,
char[] caPassphrase,
byte[] bBuffer)
Decrypts a buffer with the specified private key for this Key ID |
void |
decryptFile(String sKeyID,
char[] caPassphrase,
String sInputPath,
String sOutputPath)
Decrypts a file with an asymmetric cipher for the specified private key |
void |
encryptAndSign(String sKeyID,
char[] caPassphrase,
String sListName,
String sInputPath,
String sOutputPath)
Signs the specified file and encrypt it with an asymmetric cipher to recipients in the specified list NOTE : sListName is for further release. |
byte[] |
encryptBuffer(String sKeyID,
byte[] bBuffer)
Encrypts a buffer with the specified public key for this Key ID WARNING: Buffer length must be less than 128 bits! |
void |
encryptFile(String sListName,
String sInputPath,
String sOutputPath)
Encrypts a file with an asymmetric cipher to recipients in the specified list NOTE : sListName is for further release. |
void |
genKeyPair(String sAlgorithm,
char[] caPassphrase,
int nSize,
byte[] bSeed,
String sEmailSign,
int nIndex)
Generates a key pair and store keys separately |
String |
getRecipients(String sListName)
Gets the recipients list. |
byte[] |
getSignKeyIdDigest(String sInputPath)
Gets the ID digest of the key used to sign the file (check if it is signed before! |
boolean |
isFileSigned(String sInputPath)
Checks if an encrypted file contains a signature |
byte[] |
rawSignFile(String sKeyID,
char[] caPassphrase,
String sFilePath)
Returns the signature computed for the file with provided private key for this Key ID using the required algorithm. |
boolean |
rawVerifyFile(String sKeyID,
String sFilePath,
byte[] bSignature)
Check the validity of the file signature with the provided public key |
boolean |
removeRecipient(String sListName,
String sKeyID)
Removes a recipient from the list. |
void |
removeRecipients(String sListName)
Deletes the recipients list. |
byte[] |
signBuffer(String sKeyID,
char[] caPassphrase,
byte[] bBufferToSign)
Signs the buffer with the private key for this Key ID using the required algorithm |
void |
signFile(String sKeyID,
char[] caPassphrase,
String sFilePath,
String sSigFilePath)
Computes a signature for the file with provided private key Key ID using the required algorithm. |
boolean |
verifyBuffer(String sKeyID,
byte[] bBufferToVerify,
byte[] bSignature)
Verifies the signature of the buffer with the public key for this Key ID using the required algorithm |
boolean |
verifyFile(String sKeyID,
String sFilePath,
String sSigFilePath)
Verifies the validity of the file signature with the provided public key |
Methods inherited from class com.safeapi.CryptoCommon |
createSeedFile, getParameter, getRandomBytes, getRawError, getRegisteredError, getVersion, isOperationOK, setParameter, wipe |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CryptoAsym()
Method Detail |
public void createRecipients(String sListName)
ListName
is for later use.
sListName
- The name for this listpublic void createRecipientsTune(String sListName, int nInitialCapacity, int nCapacityIncrement)
ListName
is for later use.
sListName
- The name for this listnInitialCapacity
- The initial capacity of the vectornCapacityIncrement
- The amount by which the capacity
is increased when the vector overflowspublic boolean addRecipient(String sListName, String sKeyID)
ListName
is for later use.
sListName
- The name for this listsKeyID
- The key ID for this recipient
public boolean removeRecipient(String sListName, String sKeyID)
ListName
is for later use.
sListName
- The name for this listsKeyID
- The key ID or file path for this recipient
public void removeRecipients(String sListName)
ListName
is for later use.
sListName
- The name for this list
public String getRecipients(String sListName)
sListName
- The name for this list
public void genKeyPair(String sAlgorithm, char[] caPassphrase, int nSize, byte[] bSeed, String sEmailSign, int nIndex)
sAlgorithm
- The algorithm with which the keys will be usedcaPassphrase
- The passphrase used to save the private keynSize
- The key sizebSeed
- The seed used to generate the keysEmailSign
- The email of the ownernIndex
- The index for this keypairpublic byte[] encryptBuffer(String sKeyID, byte[] bBuffer)
sKeyID
- The Key IDbBuffer
- The buffer to encrypt, maximum 128 bits length
public byte[] decryptBuffer(String sKeyID, char[] caPassphrase, byte[] bBuffer)
sKeyID
- The Key ID of the public key to usecaPassphrase
- The passphrase protection of the private keybBuffer
- The buffer to decrypt
public byte[] signBuffer(String sKeyID, char[] caPassphrase, byte[] bBufferToSign)
sKeyID
- The Key ID of the private key to usecaPassphrase
- The passphrase for the private keybBufferToSign
- The buffer to be signed
public boolean verifyBuffer(String sKeyID, byte[] bBufferToVerify, byte[] bSignature)
sKeyID
- The Key ID of the public key to usebBufferToVerify
- The buffer to be verifiedbSignature
- The signature for the specified buffer
public byte[] rawSignFile(String sKeyID, char[] caPassphrase, String sFilePath)
sKeyID
- The Key ID of the private key to usecaPassphrase
- The passphrase of the private keysFilePath
- The file to sign
public boolean rawVerifyFile(String sKeyID, String sFilePath, byte[] bSignature)
sKeyID
- The ID of the RSA public key used for signaturesFilePath
- The file to signbSignature
- The signature to verify
public void signFile(String sKeyID, char[] caPassphrase, String sFilePath, String sSigFilePath)
sKeyID
- The Key ID of the RSA private key to use for signaturecaPassphrase
- The passphrase of the private keysFilePath
- The file to signsSigFilePath
- The file to store signaturepublic boolean verifyFile(String sKeyID, String sFilePath, String sSigFilePath)
sKeyID
- The ID of the RSA public key used for signaturesFilePath
- The file to signsSigFilePath
- The file containing the signature
public void encryptFile(String sListName, String sInputPath, String sOutputPath)
sListName
- The recipients list name.
May contain a KeyId for unique recipientsInputPath
- The full name of the file to encryptsOutputPath
- The destination filepublic void decryptFile(String sKeyID, char[] caPassphrase, String sInputPath, String sOutputPath)
sKeyID
- The ID of the RSA private keycaPassphrase
- The passphrase which protects this private keysInputPath
- The file to decryptsOutputPath
- The destination (decrypted) filepublic void encryptAndSign(String sKeyID, char[] caPassphrase, String sListName, String sInputPath, String sOutputPath)
sKeyID
- The Key ID of the private key to use for signaturecaPassphrase
- The passphrase for the signing private keysListName
- The recipients list namesInputPath
- The file to encryptsOutputPath
- The destination filepublic int decryptAndVerify(String sKeyID, char[] caPassphrase, String sSignKeyId, String sInputPath, String sOutputPath)
sKeyID
- The Key ID of the private key to usecaPassphrase
- The passphrase which protects this private keysSignKeyId
- The Key ID of the private key used for signaturesInputPath
- The file to encryptsOutputPath
- The destination file
public boolean isFileSigned(String sInputPath)
sInputPath
- the path of the file to check
public byte[] getSignKeyIdDigest(String sInputPath)
sInputPath
- the file of the encrypted file
|
SafeAPI v1.20 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |