Package com.biglybt.core.security.impl
Class CryptoSTSEngineImpl
- java.lang.Object
-
- com.biglybt.core.security.impl.CryptoSTSEngineImpl
-
- All Implemented Interfaces:
CryptoSTSEngine
final class CryptoSTSEngineImpl extends java.lang.Object implements CryptoSTSEngine
STS authentication protocol using a symmetric 4 message ECDH/ECDSA handshake
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
CryptoSTSEngineImpl.InternalDH
-
Field Summary
Fields Modifier and Type Field Description private CryptoSTSEngineImpl.InternalDH
ecDH
private java.security.KeyPair
ephemeralKeyPair
private java.security.PrivateKey
myPrivateKey
private java.security.PublicKey
myPublicKey
private java.security.PublicKey
remotePubKey
private byte[]
sharedSecret
static int
VERSION
-
Constructor Summary
Constructors Constructor Description CryptoSTSEngineImpl(java.security.PublicKey _myPub, java.security.PrivateKey _myPriv)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
getAuth(java.nio.ByteBuffer message)
protected byte[]
getBytes(java.nio.ByteBuffer buffer, int max_size)
protected int
getInt(java.nio.ByteBuffer buffer, int max_size)
void
getKeys(java.nio.ByteBuffer message)
void
getMessage(java.nio.ByteBuffer buffer, boolean keys)
byte[]
getRemotePublicKey()
byte[]
getSharedSecret()
void
putAuth(java.nio.ByteBuffer message)
protected void
putBytes(java.nio.ByteBuffer buffer, byte[] value, int max_size)
protected void
putInt(java.nio.ByteBuffer buffer, int value, int max_size)
void
putKeys(java.nio.ByteBuffer message)
void
putMessage(java.nio.ByteBuffer message, boolean keys)
-
-
-
Field Detail
-
VERSION
public static final int VERSION
- See Also:
- Constant Field Values
-
ephemeralKeyPair
private java.security.KeyPair ephemeralKeyPair
-
myPublicKey
private final java.security.PublicKey myPublicKey
-
myPrivateKey
private final java.security.PrivateKey myPrivateKey
-
remotePubKey
private java.security.PublicKey remotePubKey
-
sharedSecret
private byte[] sharedSecret
-
ecDH
private CryptoSTSEngineImpl.InternalDH ecDH
-
-
Constructor Detail
-
CryptoSTSEngineImpl
CryptoSTSEngineImpl(java.security.PublicKey _myPub, java.security.PrivateKey _myPriv) throws CryptoManagerException
- Parameters:
myIdent
- keypair representing our current identity- Throws:
CryptoManagerException
-
-
Method Detail
-
getKeys
public void getKeys(java.nio.ByteBuffer message) throws CryptoManagerException
- Specified by:
getKeys
in interfaceCryptoSTSEngine
- Throws:
CryptoManagerException
-
putKeys
public void putKeys(java.nio.ByteBuffer message) throws CryptoManagerException
- Specified by:
putKeys
in interfaceCryptoSTSEngine
- Throws:
CryptoManagerException
-
getAuth
public void getAuth(java.nio.ByteBuffer message) throws CryptoManagerException
- Specified by:
getAuth
in interfaceCryptoSTSEngine
- Throws:
CryptoManagerException
-
putAuth
public void putAuth(java.nio.ByteBuffer message) throws CryptoManagerException
- Specified by:
putAuth
in interfaceCryptoSTSEngine
- Throws:
CryptoManagerException
-
putMessage
public void putMessage(java.nio.ByteBuffer message, boolean keys) throws CryptoManagerException
- Throws:
CryptoManagerException
-
getMessage
public void getMessage(java.nio.ByteBuffer buffer, boolean keys) throws CryptoManagerException
- Throws:
CryptoManagerException
-
getSharedSecret
public byte[] getSharedSecret() throws CryptoManagerException
- Specified by:
getSharedSecret
in interfaceCryptoSTSEngine
- Throws:
CryptoManagerException
-
getRemotePublicKey
public byte[] getRemotePublicKey() throws CryptoManagerException
- Specified by:
getRemotePublicKey
in interfaceCryptoSTSEngine
- Throws:
CryptoManagerException
-
getInt
protected int getInt(java.nio.ByteBuffer buffer, int max_size) throws CryptoManagerException
- Throws:
CryptoManagerException
-
getBytes
protected byte[] getBytes(java.nio.ByteBuffer buffer, int max_size) throws CryptoManagerException
- Throws:
CryptoManagerException
-
putInt
protected void putInt(java.nio.ByteBuffer buffer, int value, int max_size) throws CryptoManagerException
- Throws:
CryptoManagerException
-
putBytes
protected void putBytes(java.nio.ByteBuffer buffer, byte[] value, int max_size) throws CryptoManagerException
- Throws:
CryptoManagerException
-
-