public final class EncryptionContext extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
EncryptionContext(int cipher)
Internal constructor
|
| Modifier and Type | Method and Description |
|---|---|
static EncryptionContext |
createInstance(NXCPMessage request)
Create encryption context based on information from session key request message.
|
byte[] |
decryptMessage(NXCPDataInputStream inputStream,
int length) |
byte[] |
encryptMessage(NXCPMessage msg)
Encrypt NXCP message.
|
int |
getCipher()
Get cipher
|
static String |
getCipherName(int cipher)
Get cipher name
|
byte[] |
getEncryptedIv(NXCPMessage msg)
Encrypt initialization vector with public key from encryption setup message.
|
byte[] |
getEncryptedSessionKey(NXCPMessage msg)
Encrypt session key with public key from encryption setup message.
|
int |
getIvLength() |
int |
getKeyLength()
Get key length (in bytes)
|
static boolean |
testCipher(int cipherId)
Test cipher with given ID
|
protected EncryptionContext(int cipher)
throws GeneralSecurityException
GeneralSecurityExceptionpublic static String getCipherName(int cipher)
cipher - cipher IDpublic static boolean testCipher(int cipherId)
cipherId - public static EncryptionContext createInstance(NXCPMessage request) throws NXCPException
request - session key request messageNXCPException - if encryption context cannot be createdpublic byte[] getEncryptedSessionKey(NXCPMessage msg) throws GeneralSecurityException
msg - encryption setup messageGeneralSecurityExceptionpublic byte[] getEncryptedIv(NXCPMessage msg) throws GeneralSecurityException
msg - encryption setup messageGeneralSecurityExceptionpublic byte[] encryptMessage(NXCPMessage msg) throws IOException, GeneralSecurityException
msg - message to encryptIOExceptionGeneralSecurityExceptionInvalidKeyExceptionpublic byte[] decryptMessage(NXCPDataInputStream inputStream, int length) throws GeneralSecurityException, IOException
inputStream - length - GeneralSecurityExceptionIOExceptionpublic int getCipher()
public int getKeyLength()
public int getIvLength()
Copyright © 2015. All rights reserved.