|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcrypto.SymmetricCipher
public class SymmetricCipher
Instances of the Symmetric cipher class arew used to cipher peer-to-peer datagram packets. Cipher's secret key is exchanged using asymmetric cipher.
Field Summary | |
---|---|
private javax.crypto.Cipher |
cipher
Instance of the cipher used to encrypt/decrypt data. |
private static java.lang.String |
mode
Cipher-Block Chaining mode. |
private static java.lang.String |
padding
PKCS5 padding. |
private javax.crypto.SecretKey |
secretKey
Secret key used to encrypt/decrypt data. |
private java.lang.String |
verificator
Contains name of the verificator (i.e the name associated with authorized public key that has verified this public key). |
Constructor Summary | |
---|---|
SymmetricCipher(javax.crypto.SecretKey secretKey,
java.lang.String verificator)
Wraps existing secret key with information about verificatory (if any). |
|
SymmetricCipher(java.lang.String algorithm,
int keySize,
boolean attnReport)
Generates a new secret key using specified algorithm and key size. |
Method Summary | |
---|---|
byte[] |
decrypt(int randomPreambleLen,
byte[] cipherText)
Decrypts cipher text first then discards random preamble of the given length. |
java.lang.String |
decrypt(java.lang.String encodedCipherText)
Decodes Base64 encoded cipher text, decrypts text message and discards random preamble. |
byte[] |
encrypt(int randomPreambleLen,
byte[] plainText)
Encrypts random preamble of the given length appended with the input plain text. |
java.lang.String |
encrypt(java.lang.String plainText)
Encrypts text message with random preamble and returns Base64 encoded cipher text. |
java.lang.String |
getAlgorithmDesc()
Returns description of the cipher algorithm |
javax.crypto.SecretKey |
getSecretKey()
Returns secret key. |
java.lang.String |
getVerificatorName()
Returns if name of the verificator from authorized keys that verified this public key |
boolean |
isActive()
Returns if cipher is properly initialized |
boolean |
isVerified()
Returns if public key was verified |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String mode
private static final java.lang.String padding
private javax.crypto.Cipher cipher
private javax.crypto.SecretKey secretKey
private java.lang.String verificator
Constructor Detail |
---|
public SymmetricCipher(javax.crypto.SecretKey secretKey, java.lang.String verificator)
public SymmetricCipher(java.lang.String algorithm, int keySize, boolean attnReport)
Method Detail |
---|
public javax.crypto.SecretKey getSecretKey()
public boolean isActive()
public boolean isVerified()
public java.lang.String getVerificatorName()
public java.lang.String getAlgorithmDesc()
public byte[] encrypt(int randomPreambleLen, byte[] plainText)
public byte[] decrypt(int randomPreambleLen, byte[] cipherText)
public java.lang.String encrypt(java.lang.String plainText)
public java.lang.String decrypt(java.lang.String encodedCipherText)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |