File tree 1 file changed +46
-0
lines changed
pg/src/main/java/org/bouncycastle/openpgp/operator
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 5
5
import org .bouncycastle .bcpg .S2K ;
6
6
import org .bouncycastle .openpgp .PGPException ;
7
7
8
+ /**
9
+ * Class responsible for encrypting secret key material or data packets using a passphrase.
10
+ * <p>
11
+ * RFC9580 recommends the following S2K specifiers + usages:
12
+ * <table border="1">
13
+ * <tr>
14
+ * <th>S2K Specifier</th>
15
+ * <th>S2K Usage</th>
16
+ * <th>Note</th>
17
+ * </tr>
18
+ * <tr>
19
+ * <td>{@link S2K#ARGON_2}</td>
20
+ * <td>{@link org.bouncycastle.bcpg.SecretKeyPacket#USAGE_AEAD}</td>
21
+ * <td>RECOMMENDED; Argon2 MUST be used with AEAD</td>
22
+ * </tr>
23
+ * <tr>
24
+ * <td>{@link S2K#SALTED_AND_ITERATED}</td>
25
+ * <td>{@link org.bouncycastle.bcpg.SecretKeyPacket#USAGE_SHA1}</td>
26
+ * <td>MAY be used if Argon2 is not available; Take care to use high octet count + strong passphrase</td>
27
+ * </tr>
28
+ * <tr>
29
+ * <td>none</td>
30
+ * <td>{@link org.bouncycastle.bcpg.SecretKeyPacket#USAGE_NONE}</td>
31
+ * <td>Unprotected</td>
32
+ * </tr>
33
+ * </table>
34
+ * <p>
35
+ * Additionally, implementations MAY use the following combinations with caution:
36
+ * <table>
37
+ * <tr>
38
+ * <th>S2K Specifier</th>
39
+ * <th>S2K Usage</th>
40
+ * <th>Note</th>
41
+ * </tr>
42
+ * <tr>
43
+ * <td>{@link S2K#SALTED_AND_ITERATED}</td>
44
+ * <td>{@link org.bouncycastle.bcpg.SecretKeyPacket#USAGE_AEAD}</td>
45
+ * <td>Does not provide memory hardness</td>
46
+ * </tr>
47
+ * <tr>
48
+ * <td>{@link S2K#SIMPLE}</td>
49
+ * <td>{@link org.bouncycastle.bcpg.SecretKeyPacket#USAGE_SHA1}</td>
50
+ * <td>Only for reading secret keys in backwards compatibility mode</td>
51
+ * </tr>
52
+ * </table>
53
+ */
8
54
public abstract class PBESecretKeyEncryptor
9
55
{
10
56
protected int encAlgorithm ;
You can’t perform that action at this time.
0 commit comments