Class ChaCha20Poly1305
java.lang.Object
com.sshtools.common.ssh.components.AbstractSshCipher
com.sshtools.common.ssh.components.jce.ChaCha20Poly1305
- All Implemented Interfaces:
Component,SshCipher,SshComponent,SecureComponent
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classPoly1305 message authentication code, designed by D. -
Field Summary
Fields inherited from interface com.sshtools.common.ssh.components.SshCipher
DECRYPT_MODE, ENCRYPT_MODE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGet the cipher block size.intReturn the key length requiredintvoidinit(int mode, byte[] iv, byte[] keydata) Initialize the cipher with up to 40 bytes of iv and key data.protected static voidintToLittleEndian(int n, byte[] bs, int off) booleanisMAC()protected static intlittleEndianToInt(byte[] bs, int i) longreadPacketLength(byte[] encoded, com.sshtools.common.util.UnsignedInteger64 sequenceNo) voidtransform(byte[] src, int start, byte[] dest, int offset, int len) Transform the byte array according to the cipher mode; it is legal for the source and destination arrays to reference the same physical array so care should be taken in the transformation process to safeguard this rule.byte[]writePacketLength(int length, com.sshtools.common.util.UnsignedInteger64 sequenceNo) Methods inherited from class com.sshtools.common.ssh.components.AbstractSshCipher
getAlgorithm, getPriority, getSecurityLevel, transform
-
Constructor Details
-
ChaCha20Poly1305
- Throws:
IOException
-
-
Method Details
-
init
Description copied from class:AbstractSshCipherInitialize the cipher with up to 40 bytes of iv and key data. Each implementation should take as much data from the initialization as it needs ignoring any data that it does not require.- Specified by:
initin interfaceSshCipher- Specified by:
initin classAbstractSshCipher- Parameters:
mode- the mode to operateiv- the initiaization vectorkeydata- the key data- Throws:
IOException
-
getBlockSize
public int getBlockSize()Description copied from class:AbstractSshCipherGet the cipher block size.- Specified by:
getBlockSizein interfaceSshCipher- Specified by:
getBlockSizein classAbstractSshCipher- Returns:
- the block size in bytes.
-
getKeyLength
public int getKeyLength()Description copied from class:AbstractSshCipherReturn the key length required- Specified by:
getKeyLengthin interfaceSshCipher- Specified by:
getKeyLengthin classAbstractSshCipher- Returns:
-
getMacLength
public int getMacLength()- Specified by:
getMacLengthin interfaceSshCipher- Overrides:
getMacLengthin classAbstractSshCipher
-
isMAC
public boolean isMAC()- Specified by:
isMACin interfaceSshCipher- Overrides:
isMACin classAbstractSshCipher
-
transform
Description copied from class:AbstractSshCipherTransform the byte array according to the cipher mode; it is legal for the source and destination arrays to reference the same physical array so care should be taken in the transformation process to safeguard this rule.- Specified by:
transformin interfaceSshCipher- Specified by:
transformin classAbstractSshCipher- Throws:
IOException
-
getProviderName
- Specified by:
getProviderNamein interfaceSshCipher- Specified by:
getProviderNamein classAbstractSshCipher
-
readPacketLength
public long readPacketLength(byte[] encoded, com.sshtools.common.util.UnsignedInteger64 sequenceNo) throws IOException - Throws:
IOException
-
writePacketLength
public byte[] writePacketLength(int length, com.sshtools.common.util.UnsignedInteger64 sequenceNo) throws IOException - Throws:
IOException
-
littleEndianToInt
protected static int littleEndianToInt(byte[] bs, int i) -
intToLittleEndian
protected static void intToLittleEndian(int n, byte[] bs, int off)
-