| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcrypto.PublicEncryptor
public class PublicEncryptor
Implements public part of the asymmetric cipher (with public key) used to send encrypted local secret key (used for symmetric ciphering of peer-to-peer datagram packets) to remote peer. The class holds also list of authorized public keys, which is used to verify signed objects received from peers.
| Field Summary | |
|---|---|
| private static java.util.ArrayList<NamedPublicKey> | authorizedKeysAuthorized public keys (loaded from file) | 
| private static java.lang.String | authorizedKeysFileThe name of the file holding authorized public keys of remote peers | 
| private  javax.crypto.Cipher | cipherInstance of the encrypting engine based on remote public key | 
| private static java.lang.String | digestMessage digest used for creating/validating signatures | 
| private static java.lang.String | paddingPadding to be used when ciphering/deciphering JCE does not support RSA/CBC so the CBC mode is built on the top of ECB in PublicEncryptor.encrypt(). | 
| private  java.security.PublicKey | publicKeyPublic key | 
| private  java.lang.String | serializedPublicKeyRemote public key: serialized and encoded as Base64 string. | 
| private  java.lang.String | verificatorContains name of the verificator (i.e the name associated with authorized public key that has verified this public key). | 
| Constructor Summary | |
|---|---|
| PublicEncryptor(java.lang.String serializedPublicKey,
                java.lang.String remoteUserId)Deserializes public key from the Base64 string and instantiates PublicEncryptor. | |
| Method Summary | |
|---|---|
| private static void | createEmptyAuthorizedPublicKeys(java.lang.String filename)Create empty authorized keys file if it does not exist and adjust permissions. | 
|  byte[] | encrypt(byte[] plainText)Encrypts plain text using public key. | 
|  java.lang.String | encryptAndSerialize(java.io.Serializable object)Returns Base64 of encrypted (using our public key) object. | 
|  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 | 
| static void | loadAuthorizedPublicKeys()Loads authorized keys | 
| static java.lang.String | verifyObject(java.security.SignedObject object)Verifies signed object with a public key from the authorized public keys | 
| 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 padding
private static final java.lang.String digest
private static final java.lang.String authorizedKeysFile
private static java.util.ArrayList<NamedPublicKey> authorizedKeys
private java.security.PublicKey publicKey
private javax.crypto.Cipher cipher
private java.lang.String serializedPublicKey
private java.lang.String verificator
| Constructor Detail | 
|---|
public PublicEncryptor(java.lang.String serializedPublicKey,
                       java.lang.String remoteUserId)
| Method Detail | 
|---|
private static void createEmptyAuthorizedPublicKeys(java.lang.String filename)
public static void loadAuthorizedPublicKeys()
public static java.lang.String verifyObject(java.security.SignedObject object)
public boolean isActive()
public boolean isVerified()
public java.lang.String getVerificatorName()
public byte[] encrypt(byte[] plainText)
AsymmetricCipher.decrypt(byte[])public java.lang.String encryptAndSerialize(java.io.Serializable object)
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||