Class CryptoHandlerECC
java.lang.Object
com.biglybt.core.security.impl.CryptoHandlerECC
- All Implemented Interfaces:
CryptoHandler
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate static final Stringprivate static final Long(package private) final intprivate long(package private) final CryptoManagerImplprivate static final intprivate PrivateKeyprivate PublicKey -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCryptoHandlerECC(CryptoManagerImpl _manager, int _instance_id) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckKeysOK(String reason) protected Key[]createAndStoreKeys(CryptoManagerImpl.passwordDetails password_details) protected Key[]createAndStoreKeys(String reason) byte[]byte[]protected intintbyte[]getEncryptedPrivateKey(String reason) intprotected PrivateKeygetMyPrivateKey(String reason) protected PublicKeygetMyPublicKey(String reason, boolean create_if_needed) byte[]getPublicKey(String reason) getSTSEngine(String reason) getSTSEngine(PublicKey public_key, PrivateKey private_key) intgetType()intbooleanimportKeys(String str) booleanvoidlock()Puts the handler back into a state where password will be required to access private stuffbyte[]voidrecoverKeys(byte[] public_key, byte[] encrypted_private_key_and_type) voidvoidsetDefaultPasswordHandlerType(int new_type) voidsetUnlockTimeoutSeconds(int secs) byte[]voidunlock()Explicit unlock requestbooleanverify(byte[] public_key, byte[] data, byte[] signature) booleanverifyPublicKey(byte[] encoded)
-
Field Details
-
DEFAULT_PASSWORD
- See Also:
-
DEFAULT_TIMEOUT
-
TIMEOUT_DEFAULT_SECS
private static final int TIMEOUT_DEFAULT_SECS- See Also:
-
manager
-
instance_id
final int instance_id -
CONFIG_PREFIX
-
use_method_private_key
-
use_method_public_key
-
last_unlock_time
private long last_unlock_time
-
-
Constructor Details
-
CryptoHandlerECC
-
-
Method Details
-
getType
public int getType()- Specified by:
getTypein interfaceCryptoHandler
-
getInstance
public int getInstance()- Specified by:
getInstancein interfaceCryptoHandler
-
unlock
Description copied from interface:CryptoHandlerExplicit unlock request- Specified by:
unlockin interfaceCryptoHandler- Throws:
CryptoManagerException
-
isUnlocked
public boolean isUnlocked()- Specified by:
isUnlockedin interfaceCryptoHandler
-
lock
public void lock()Description copied from interface:CryptoHandlerPuts the handler back into a state where password will be required to access private stuff- Specified by:
lockin interfaceCryptoHandler
-
getUnlockTimeoutSeconds
public int getUnlockTimeoutSeconds()- Specified by:
getUnlockTimeoutSecondsin interfaceCryptoHandler
-
setUnlockTimeoutSeconds
public void setUnlockTimeoutSeconds(int secs) - Specified by:
setUnlockTimeoutSecondsin interfaceCryptoHandler- Parameters:
secs- 0-> infinite
-
sign
- Specified by:
signin interfaceCryptoHandler- Throws:
CryptoManagerException
-
verify
public boolean verify(byte[] public_key, byte[] data, byte[] signature) throws CryptoManagerException - Specified by:
verifyin interfaceCryptoHandler- Throws:
CryptoManagerException
-
encrypt
public byte[] encrypt(byte[] other_public_key, byte[] data, String reason) throws CryptoManagerException - Specified by:
encryptin interfaceCryptoHandler- Throws:
CryptoManagerException
-
decrypt
public byte[] decrypt(byte[] other_public_key, byte[] data, String reason) throws CryptoManagerException - Specified by:
decryptin interfaceCryptoHandler- Throws:
CryptoManagerException
-
getSTSEngine
- Specified by:
getSTSEnginein interfaceCryptoHandler- Throws:
CryptoManagerException
-
getSTSEngine
public CryptoSTSEngine getSTSEngine(PublicKey public_key, PrivateKey private_key) throws CryptoManagerException - Specified by:
getSTSEnginein interfaceCryptoHandler- Throws:
CryptoManagerException
-
peekPublicKey
public byte[] peekPublicKey()- Specified by:
peekPublicKeyin interfaceCryptoHandler
-
getPublicKey
- Specified by:
getPublicKeyin interfaceCryptoHandler- Throws:
CryptoManagerException
-
getEncryptedPrivateKey
- Specified by:
getEncryptedPrivateKeyin interfaceCryptoHandler- Throws:
CryptoManagerException
-
recoverKeys
public void recoverKeys(byte[] public_key, byte[] encrypted_private_key_and_type) throws CryptoManagerException - Specified by:
recoverKeysin interfaceCryptoHandler- Throws:
CryptoManagerException
-
resetKeys
- Specified by:
resetKeysin interfaceCryptoHandler- Throws:
CryptoManagerException
-
getMyPrivateKey
- Throws:
CryptoManagerException
-
checkKeysOK
- Throws:
CryptoManagerException
-
getMyPublicKey
protected PublicKey getMyPublicKey(String reason, boolean create_if_needed) throws CryptoManagerException - Throws:
CryptoManagerException
-
getDefaultPasswordHandlerType
public int getDefaultPasswordHandlerType()- Specified by:
getDefaultPasswordHandlerTypein interfaceCryptoHandler
-
setDefaultPasswordHandlerType
- Specified by:
setDefaultPasswordHandlerTypein interfaceCryptoHandler- Throws:
CryptoManagerException
-
createAndStoreKeys
- Throws:
CryptoManagerException
-
createAndStoreKeys
protected Key[] createAndStoreKeys(CryptoManagerImpl.passwordDetails password_details) throws CryptoManagerException - Throws:
CryptoManagerException
-
verifyPublicKey
public boolean verifyPublicKey(byte[] encoded) - Specified by:
verifyPublicKeyin interfaceCryptoHandler
-
exportKeys
- Specified by:
exportKeysin interfaceCryptoHandler- Throws:
CryptoManagerException
-
importKeys
- Specified by:
importKeysin interfaceCryptoHandler- Parameters:
str-- Returns:
- true if a client restart is required
- Throws:
CryptoManagerException
-
getCurrentPasswordType
protected int getCurrentPasswordType()
-