public class EncryptionSession extends Object implements IEncryptionSession
Represents an instance of document encryption
Constructor and Description |
---|
EncryptionSession(EncryptionConfig config,
CryptoEncryptionData data)
Initializes a new instance of the
EncryptionSession class. |
Modifier and Type | Method and Description |
---|---|
static IEncryptionSession |
createInstance(String password)
Initializes a new instance of the
EncryptionSession class. |
com.aspose.ms.System.IO.Stream |
decrypt(byte[] encryptedBytes)
Decrypts encrypted data.
|
com.aspose.ms.System.IO.Stream |
decrypt(byte[] encryptedBytes,
int encryptedPackageLength)
Decrypts encrypted data when encrypted package doesn't contain the real length.
|
com.aspose.ms.System.IO.Stream |
decrypt(com.aspose.ms.System.IO.Stream stream)
The decrypt.
|
byte[] |
encrypt(byte[] buffer)
Encrypts a data.
|
int |
getCipherBlockBytes()
Gets the cipher block bytes.
|
com.aspose.ms.System.Security.Cryptography.ICryptoTransform |
getDecryptor()
The get decryptor.
|
com.aspose.ms.System.IO.Stream |
getEncryptedStream(com.aspose.ms.System.IO.Stream stream)
The get encrypted stream.
|
byte[] |
getEncryptionConfig()
Gets an encryption config.
|
com.aspose.ms.System.Security.Cryptography.ICryptoTransform |
getEncryptor()
The get encryptor.
|
boolean |
isUnlocked()
Gets a value indicating whether is unlocked.
|
static IEncryptionSession |
loadFromStream(com.aspose.ms.System.IO.Stream stream)
The load from stream.
|
void |
save(EncryptionConfig[] config,
CryptoEncryptionData[] data)
The save.
|
void |
setPassword(String password)
Sets the password.
|
boolean |
unlockWithPassword(String password)
The unlock with password.
|
void |
writeToStream(com.aspose.ms.System.IO.Stream stream)
The write to stream.
|
public EncryptionSession(EncryptionConfig config, CryptoEncryptionData data)
Initializes a new instance of the EncryptionSession
class.
config
- The config.data
- The data.public static IEncryptionSession createInstance(String password)
Initializes a new instance of the EncryptionSession
class.
password
- The password.IEncryptionSession
.public boolean isUnlocked()
Gets a value indicating whether is unlocked.
isUnlocked
in interface IEncryptionSession
public int getCipherBlockBytes()
Gets the cipher block bytes.
getCipherBlockBytes
in interface IEncryptionSession
public static IEncryptionSession loadFromStream(com.aspose.ms.System.IO.Stream stream)
The load from stream.
stream
- The stream.IEncryptionSession
.public void setPassword(String password)
Sets the password.
setPassword
in interface IEncryptionSession
password
- The password.public boolean unlockWithPassword(String password)
The unlock with password.
unlockWithPassword
in interface IEncryptionSession
password
- The password.bool
.com.aspose.ms.System.InvalidOperationException
- Can't unlock encryption session using specified password.public void writeToStream(com.aspose.ms.System.IO.Stream stream)
The write to stream.
writeToStream
in interface IEncryptionSession
stream
- The stream.public byte[] getEncryptionConfig()
Gets an encryption config.
getEncryptionConfig
in interface IEncryptionSession
public com.aspose.ms.System.IO.Stream getEncryptedStream(com.aspose.ms.System.IO.Stream stream)
The get encrypted stream.
getEncryptedStream
in interface IEncryptionSession
stream
- The stream.EncryptedStream
.com.aspose.ms.System.InvalidOperationException
- Encryption session was not unlocked.public com.aspose.ms.System.IO.Stream decrypt(byte[] encryptedBytes)
Decrypts encrypted data. Real package length should be placed in the beginning of the encrypted package.
decrypt
in interface IEncryptionSession
public com.aspose.ms.System.IO.Stream decrypt(byte[] encryptedBytes, int encryptedPackageLength)
Decrypts encrypted data when encrypted package doesn't contain the real length.
decrypt
in interface IEncryptionSession
public com.aspose.ms.System.IO.Stream decrypt(com.aspose.ms.System.IO.Stream stream)
The decrypt.
decrypt
in interface IEncryptionSession
public byte[] encrypt(byte[] buffer)
Encrypts a data.
encrypt
in interface IEncryptionSession
public com.aspose.ms.System.Security.Cryptography.ICryptoTransform getEncryptor()
The get encryptor.
getEncryptor
in interface IEncryptionSession
ICryptoTransform
.public com.aspose.ms.System.Security.Cryptography.ICryptoTransform getDecryptor()
The get decryptor.
getDecryptor
in interface IEncryptionSession
ICryptoTransform
.public void save(EncryptionConfig[] config, CryptoEncryptionData[] data)
The save.
save
in interface IEncryptionSession
config
- The config.data
- The data.Copyright (c) 2016 Aspose. All Rights Reserved.