blob: a889b3beb7c279a07f49d2344b3d729e5d8bb57c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package org.spongycastle.openpgp.operator;
import java.security.SecureRandom;
import org.spongycastle.bcpg.SymmetricKeyAlgorithmTags;
import org.spongycastle.openpgp.PGPException;
/**
* A builder for {@link PGPDataEncryptor} instances, which can be used to encrypt data objects.
*/
public interface PGPDataEncryptorBuilder
{
/**
* The encryption algorithm used by data encryptors created by this builder.
*
* @return one of the {@link SymmetricKeyAlgorithmTags symmetric encryption algorithms}.
*/
int getAlgorithm();
/**
* Builds a data encryptor using the algorithm configured for this builder.
*
* @param keyBytes the bytes of the key to use for the cipher.
* @return a data encryptor with an initialised cipher.
* @throws PGPException if an error occurs initialising the configured encryption.
*/
PGPDataEncryptor build(byte[] keyBytes)
throws PGPException;
/**
* Gets the SecureRandom instance used by this builder. <br/>
* If a SecureRandom has not been explicitly configured, a default {@link SecureRandom} is
* constructed and retained by the this builder.
*/
SecureRandom getSecureRandom();
}
|