|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.universaldevices.security.upnp.UPnPSecurity
public class UPnPSecurity
This class encapsulates all the necessary methods to conform to UPnP Security standards
Field Summary | |
---|---|
static java.lang.String |
BLOCK_CIPHER_MODE
|
static java.lang.String |
BLOCK_CIPHER_PADDING
|
static int |
BULK_CIPHER_LENGTH
|
static java.lang.String |
BULK_CIPHER_NAME
UPnP Security |
static java.lang.String |
BULK_CIPHER_PARAMETERS
|
java.lang.String |
controlURL
Used for signing UPnP messages; this is the URL to which Services are directed in ISY |
static java.lang.String |
DEFAULT_DEVICE_BULK_ALGORITHM
|
static java.lang.String |
DEFAULT_DEVICE_HMAC_ALGORITHM
|
static java.lang.String |
DEFAULT_DEVICE_HMAC_ALGORITHM_JAVA
|
static java.lang.String |
DEFAULT_DIGEST_ALGORITHM_JAVA
|
static java.lang.String |
DEFAULT_PUBLIC_KEY_SIGNATURE_METHOD
|
java.security.PublicKey |
devRSAPubKey
|
java.lang.String |
devSessionId
|
UPnPBulkCipher |
encryptionFromDevice
The bulk cipher used to receive communications from ISY This object is not used |
UPnPBulkCipher |
encryptionToDevice
The bulk cipher used to communicate to ISY |
boolean |
isExpired
|
java.lang.String |
lifetimeSequenceBase
This is used to reduce the replay attacks |
static short |
NO_SECURITY
ISY is not security enabled |
static short |
NO_SIGNATURE
No signature/encryption is applied |
static java.lang.String |
RSA_CIPHER_PARAMETERS
|
java.security.KeyPair |
rsaKeyPair
|
static short |
SECURITY_LEVEL_1
ISY supports clear text userid/pwd authentication but requires all messages to be digitally signed |
static short |
SECURITY_LEVEL_2
ISY supports bulk key encryption on sensitive messages and also requires all messages to be signed |
static short |
SECURITY_LEVEL_3
ISY requires RSA/PublicKey cryptography |
static short |
SIGN_WITH_HMAC_KEY
Signs messages using HMAC |
static short |
SIGN_WITH_PUBLIC_KEY
Signs messages using Public Key |
UPnPHMAC |
signatureFromDevice
HMAC signature to be used to receive communications from ISY |
UPnPHMAC |
signatureToDevice
HMAC signature to be used to communicate with ISY |
static long |
START_SEQUENCE_NUMBER
Internal Library use only |
Constructor Summary | |
---|---|
UPnPSecurity()
Constructor, default |
Method Summary | |
---|---|
boolean |
createSecuritySession(short securityLevel)
Creates a UPnP Security Session instance based on the given security level |
byte[] |
decrypt(java.lang.String cipherText,
byte[] iv)
Decrypts a cipher |
java.lang.StringBuffer |
encrypt(java.lang.StringBuffer plainText)
Encrypts a plaintext with the bulk key to Device key |
boolean |
expire()
Returns true if the security session has expired |
java.lang.StringBuffer |
getSecuritySessionBody(short securityLevel)
Sings and encrypts (if necessary) a SOAP body |
boolean |
refresh()
Refreshes this UPnP security session based on the new parameters retrieved from ISY. |
boolean |
setDevicePublicKey(java.lang.String modulus,
java.lang.String exponent)
Updates the devices public key with the information retrieved from the device |
void |
setFreshness(java.lang.String lifetimeSequenceBase,
java.lang.String controlURL)
Sets the UPnP Security's freshness value |
java.lang.StringBuffer |
sign(java.lang.StringBuffer body,
boolean isPubKeySigned,
short securityLevel)
Signs and encrypts the body with PK or BK |
void |
updateSession(java.lang.String lifetimeSequenceBase,
java.lang.String devSessionId)
Updates a UPnP Security Session based on the given values |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final short NO_SIGNATURE
public static final short SIGN_WITH_PUBLIC_KEY
public static final short SIGN_WITH_HMAC_KEY
public UPnPBulkCipher encryptionToDevice
public UPnPBulkCipher encryptionFromDevice
This object is not used
public UPnPHMAC signatureToDevice
public UPnPHMAC signatureFromDevice
public java.lang.String controlURL
public java.lang.String lifetimeSequenceBase
public java.security.KeyPair rsaKeyPair
public java.security.PublicKey devRSAPubKey
public java.lang.String devSessionId
public boolean isExpired
public static final java.lang.String BULK_CIPHER_NAME
public static final java.lang.String BLOCK_CIPHER_MODE
public static final java.lang.String BLOCK_CIPHER_PADDING
public static final java.lang.String BULK_CIPHER_PARAMETERS
public static final int BULK_CIPHER_LENGTH
public static final java.lang.String RSA_CIPHER_PARAMETERS
public static final java.lang.String DEFAULT_DEVICE_BULK_ALGORITHM
public static final java.lang.String DEFAULT_DEVICE_HMAC_ALGORITHM_JAVA
public static final java.lang.String DEFAULT_DIGEST_ALGORITHM_JAVA
public static final java.lang.String DEFAULT_DEVICE_HMAC_ALGORITHM
public static final java.lang.String DEFAULT_PUBLIC_KEY_SIGNATURE_METHOD
public static final short NO_SECURITY
public static final short SECURITY_LEVEL_1
public static final short SECURITY_LEVEL_2
public static final short SECURITY_LEVEL_3
public static final long START_SEQUENCE_NUMBER
Constructor Detail |
---|
public UPnPSecurity()
Method Detail |
---|
public boolean createSecuritySession(short securityLevel)
securityLevel
- - the security level
public boolean refresh()
public boolean setDevicePublicKey(java.lang.String modulus, java.lang.String exponent)
modulus
- - the modulusexponent
- - the exponent
public void setFreshness(java.lang.String lifetimeSequenceBase, java.lang.String controlURL)
lifetimeSequenceBase
- - the sequence base numbercontrolURL
- - the controlURLpublic void updateSession(java.lang.String lifetimeSequenceBase, java.lang.String devSessionId)
lifetimeSequenceBase
- - the sequence numberdevSessionId
- - the security session's IDpublic java.lang.StringBuffer getSecuritySessionBody(short securityLevel)
Based on the security level, signs/encrypts and does what ever is necessary to conform the body of the SOAP message to UPnP Security 1.0
securityLevel
- - the security level being reported by ISY
public java.lang.StringBuffer sign(java.lang.StringBuffer body, boolean isPubKeySigned, short securityLevel)
Signs the body with either the public key or the Sign key provided in the signKeyToDevice HMAC
body
- isPubKeySigned
-
public boolean expire()
public java.lang.StringBuffer encrypt(java.lang.StringBuffer plainText)
plainText
- - the text to be encrypted
public byte[] decrypt(java.lang.String cipherText, byte[] iv)
cipherText
- iv
- - the initial vector
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |