public final class EncryptionContext
extends java.lang.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 java.lang.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 java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static java.lang.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 java.security.GeneralSecurityException
msg - encryption setup messagejava.security.GeneralSecurityExceptionpublic byte[] getEncryptedIv(NXCPMessage msg) throws java.security.GeneralSecurityException
msg - encryption setup messagejava.security.GeneralSecurityExceptionpublic byte[] encryptMessage(NXCPMessage msg) throws java.io.IOException, java.security.GeneralSecurityException
msg - message to encryptjava.io.IOExceptionjava.security.GeneralSecurityExceptionjava.security.InvalidKeyExceptionpublic byte[] decryptMessage(NXCPDataInputStream inputStream, int length) throws java.security.GeneralSecurityException, java.io.IOException
inputStream - length - java.security.GeneralSecurityExceptionjava.io.IOExceptionpublic int getCipher()
public int getKeyLength()
public int getIvLength()
Copyright © 2014. All Rights Reserved.