|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.rsa.swsj.XMLSecurityOperation
com.rsa.swsj.encryption.XMLEncryption
This is the main class for XML encryption. It stores all the nessesary data, such as an encryption algorithm or encryption keys, and performs encryption and decryption operations.
| Field Summary | |
static java.lang.String |
ALG_ENCRYPTION_AES128
AES 128-bit encryption algorithm. |
static java.lang.String |
ALG_ENCRYPTION_AES256
AES 256-bit encryption algorithm. |
static java.lang.String |
ALG_ENCRYPTION_RC4
RC4 128-bit encryption algorithm. |
static java.lang.String |
ALG_ENCRYPTION_TRIPLE_DES
Triple DES encryption algorithm. |
static java.lang.String |
ALG_KEY_WRAP_AES128
AES 128-bit key wrapping algorithm for XML Encryption. |
static java.lang.String |
ALG_KEY_WRAP_AES256
AES 256-bit key wrapping algorithm for XML Encryption. |
static java.lang.String |
ALG_KEY_WRAP_TRIPLE_DES
Triple DES key wrapping algorithm for XML Encryption. |
static java.lang.String |
ALG_TRANSPORT_RSA
RSA key transport algorithm for XML Encryption. |
static java.lang.String |
ALG_TRANSPORT_RSA_OAEP
RSA with OAEP key transport algorithm for XML Encryption. |
static int |
CONTENT_ENCRYPTION
Specifies that the |
static int |
DATA_ENCRYPTION
Specifies that the |
static int |
ELEMENT_ENCRYPTION
Specifies that the |
| Constructor Summary | |
XMLEncryption(SWSJContext context)
This is the default constructor. |
|
XMLEncryption(SWSJContext context,
java.lang.String reference,
java.security.PublicKey pubKey)
This constructor should be used in simple cases. |
|
| Method Summary | |
void |
addReference(Reference reference)
Adds a |
byte[] |
getCipherData()
Gets the encrypted data. |
java.lang.String |
getEncoding()
Gets the encoding format of the decrypted data. |
java.lang.String |
getEncryptionMethod()
Gets the encryption method. |
java.lang.String |
getMimeType()
Returns the mime type of the decrypted data. |
javax.crypto.SecretKey |
getSecretKey()
Gets the secret key used to encrypt or decrypt data. |
int |
getType()
Gets the encryption type. |
javax.crypto.SecretKey |
getWrappingKey()
Gets the key used for wrapping the encryption key. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding format to encoding. |
void |
setEncryptionMethod(java.lang.String encryptionMethod)
Sets the encryption method to encryptionMethod. |
void |
setMimeType(java.lang.String mimeType)
Sets the mime type to mimeType Call this method only when encrypting the document. |
void |
setReferences(Reference[] references)
Sets the array of references. |
void |
setSecretKey(javax.crypto.SecretKey secretKey)
Sets the secret key that will be used to encrypt or decrypt data. |
void |
setTransportKey(java.security.PrivateKey transportKey)
Sets the transport key which may decrypt the secret key that encrypted the encrypted data. |
void |
setType(int type)
Sets the encryption type to type. |
void |
setWrappingKey(javax.crypto.SecretKey wrapKey)
Sets the key used for wrapping the encryption key. |
| Methods inherited from class com.rsa.swsj.XMLSecurityOperation |
getContext, getId, getNamespacePrefix, getOutputStream, getParameters, getReferences, getStatusInfo, getTimestamp, setExpirationTime, setId, setLocation, setNamespacePrefix, setOutputStream, setParameters, skip |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int ELEMENT_ENCRYPTION
EncryptedData element contains data of
the type element.
public static final int CONTENT_ENCRYPTION
EncryptedData element contains data of
element content.
public static final int DATA_ENCRYPTION
EncryptedData element contains arbitrary
data.
public static final java.lang.String ALG_ENCRYPTION_TRIPLE_DES
public static final java.lang.String ALG_ENCRYPTION_RC4
public static final java.lang.String ALG_ENCRYPTION_AES128
public static final java.lang.String ALG_ENCRYPTION_AES256
public static final java.lang.String ALG_TRANSPORT_RSA
public static final java.lang.String ALG_TRANSPORT_RSA_OAEP
public static final java.lang.String ALG_KEY_WRAP_TRIPLE_DES
public static final java.lang.String ALG_KEY_WRAP_AES128
public static final java.lang.String ALG_KEY_WRAP_AES256
| Constructor Detail |
public XMLEncryption(SWSJContext context)
throws EncryptionException
XMLEncryption object initialized only with a context.
context - An object that collects a number of common parameters and
state variables; for example, JCE provider.
EncryptionException - If context is invalid.
public XMLEncryption(SWSJContext context,
java.lang.String reference,
java.security.PublicKey pubKey)
throws EncryptionException
XMLEncryption object and sets all nessesary values. By
default the entire element is encrypted, and
XMLEncryption.ALG_ENCRYPTION_AES256 is used for
encryption.
context - An object that collects a number of common parameters and
state variables.reference - The data to encrypt.pubKey - The transport key used to encrypt the encryption key.
EncryptionException - If any parameter is invalid.| Method Detail |
public void setSecretKey(javax.crypto.SecretKey secretKey)
throws EncryptionException
secretKey - A key to encrypt or decrypt data
EncryptionException - If this key's algorithm is not supported.public javax.crypto.SecretKey getSecretKey()
public void setWrappingKey(javax.crypto.SecretKey wrapKey)
throws EncryptionException
wrapKey - The wrapping key.
EncryptionExceptionpublic javax.crypto.SecretKey getWrappingKey()
public void setEncryptionMethod(java.lang.String encryptionMethod)
throws EncryptionException
encryptionMethod - A String value that specifies the
algorithm used for encryption and decryption.
EncryptionException - If the given encryption method value is
not supported.public java.lang.String getEncryptionMethod()
String containing the algorithm used for
encryption and decryption.
public void setType(int type)
throws InvalidParameterException
setType in class XMLSecurityOperationtype - An integer containing the value of the encryption type,
defined in this class.
InvalidParameterExceptionpublic int getType()
getType in class XMLSecurityOperationpublic void setMimeType(java.lang.String mimeType)
mimeType - A string containing the mime type of the original data
to encrypt.public java.lang.String getMimeType()
String containing the mime type.public void setEncoding(java.lang.String encoding)
encoding - A string specifying the encoding format for the original
data to encrypt.public java.lang.String getEncoding()
String containing the encoding format.public byte[] getCipherData()
byte array.
public void setReferences(Reference[] references)
throws InvalidParameterException
setReferences in class XMLSecurityOperationreferences - An array of references.
InvalidParameterException - If any of the references is null.
public void addReference(Reference reference)
throws InvalidParameterException
Reference. For encryption, the only allowed
transform is XPATH which is used to locate the data to be encrypted.
addReference in class XMLSecurityOperationreference - The reference to add.
InvalidParameterException - If the reference is null.public void setTransportKey(java.security.PrivateKey transportKey)
transportKey - The transport key to use for decryption.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||