Skip to content

Commit f0474a0

Browse files
committed
Merge branch '1857-1-javadoc' into 'main'
JavaDoc from 1857 branch: PBESecretKeyEncryptor, CryptlibObjectIdentifiers,... See merge request root/bc-java!45
2 parents 4953a48 + 74b0afc commit f0474a0

File tree

10 files changed

+92
-3
lines changed

10 files changed

+92
-3
lines changed

pg/src/main/java/org/bouncycastle/openpgp/operator/PBEDataDecryptorFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
/**
99
* A factory for performing PBE decryption operations.
10+
* The purpose of this class is to act as an abstract factory, whose subclasses can decide, which concrete
11+
* implementation to use for symmetric decryption of SKESK (symmetric-key-encrypted session-key) packets.
1012
*/
1113
public abstract class PBEDataDecryptorFactory
1214
implements PGPDataDecryptorFactory

pg/src/main/java/org/bouncycastle/openpgp/operator/PBESecretKeyEncryptor.java

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,52 @@
55
import org.bouncycastle.bcpg.S2K;
66
import org.bouncycastle.openpgp.PGPException;
77

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+
*/
854
public abstract class PBESecretKeyEncryptor
955
{
1056
protected int encAlgorithm;
@@ -80,8 +126,8 @@ public S2K getS2K()
80126
* Key encryption method invoked for V4 keys and greater.
81127
*
82128
* @param keyData raw key data
83-
* @param keyOff offset into raw key data
84-
* @param keyLen length of key data to use.
129+
* @param keyOff offset into raw key data
130+
* @param keyLen length of key data to use.
85131
* @return an encryption of the passed in keyData.
86132
* @throws PGPException on error in the underlying encryption process.
87133
*/

pg/src/main/java/org/bouncycastle/openpgp/operator/PGPContentSignerBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
import org.bouncycastle.openpgp.PGPException;
44
import org.bouncycastle.openpgp.PGPPrivateKey;
55

6+
/**
7+
* Builder for {@link PGPContentSigner} objects.
8+
* The purpose of this class is to act as an abstract factory, whose subclasses can decide, which concrete
9+
* implementation to use for the {@link PGPContentSigner}.
10+
*/
611
public interface PGPContentSignerBuilder
712
{
813
PGPContentSigner build(final int signatureType, final PGPPrivateKey privateKey)

pg/src/main/java/org/bouncycastle/openpgp/operator/PGPContentVerifierBuilderProvider.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
import org.bouncycastle.openpgp.PGPException;
44

5+
/**
6+
* Provider for {@link PGPContentVerifierBuilder} instances.
7+
* The purpose of this class is to act as an abstract factory, whose subclasses can decide, which concrete
8+
* implementation of {@link PGPContentVerifierBuilder} (builder for objects check signatures for correctness)
9+
* to provide.
10+
*/
511
public interface PGPContentVerifierBuilderProvider
612
{
713
PGPContentVerifierBuilder get(int keyAlgorithm, int hashAlgorithm)

pg/src/main/java/org/bouncycastle/openpgp/operator/PGPDigestCalculatorProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
/**
77
* A factory for digest algorithms.
8+
* The purpose of this class is to act as an abstract factory, whose subclasses can decide, which concrete
9+
* implementation to use for calculating PGP digests.
810
*/
911
public interface PGPDigestCalculatorProvider
1012
{

pg/src/main/java/org/bouncycastle/openpgp/operator/PublicKeyDataDecryptorFactory.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
import org.bouncycastle.bcpg.PublicKeyEncSessionPacket;
55
import org.bouncycastle.openpgp.PGPException;
66

7+
/**
8+
* Factory for public-key based {@link PGPDataDecryptor PGPDataDecryptors}.
9+
* The purpose of this class is to act as an abstract factory, whose subclasses can decide, which concrete
10+
* implementation to use to decrypt OpenPGP messages that were encrypted to a public-key.
11+
*/
712
public interface PublicKeyDataDecryptorFactory
813
extends PGPDataDecryptorFactory
914
{

pg/src/main/java/org/bouncycastle/openpgp/operator/PublicKeyKeyEncryptionMethodGenerator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
import java.io.IOException;
1212
import java.math.BigInteger;
1313

14+
/**
15+
* Abstract generator class for encryption methods that produce PKESK (public-key encrypted session key) packets.
16+
* PKESKs are used when encrypting a message for a recipients public key.
17+
* The purpose of this class is to allow subclasses to decide, which implementation to use.
18+
*/
1419
public abstract class PublicKeyKeyEncryptionMethodGenerator
1520
extends PGPKeyEncryptionMethodGenerator
1621
{

pg/src/main/java/org/bouncycastle/openpgp/operator/SessionKeyDataDecryptorFactory.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
import org.bouncycastle.openpgp.PGPSessionKey;
44

5+
/**
6+
* Factory for {@link PGPDataDecryptor} objects that use a {@link PGPSessionKey} to decrypt the content of an
7+
* OpenPGP message.
8+
* The purpose of this class is to act as an abstract factory, whose subclasses can decide, which concrete
9+
* implementation to use for message decryption.
10+
*/
511
public interface SessionKeyDataDecryptorFactory
612
extends PGPDataDecryptorFactory
713
{

util/src/main/java/org/bouncycastle/asn1/cryptlib/CryptlibObjectIdentifiers.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,11 @@ public class CryptlibObjectIdentifiers
88

99
public static final ASN1ObjectIdentifier ecc = cryptlib.branch("1").branch("5");
1010

11+
/**
12+
* Curve25519Legacy for use with ECDH.
13+
*
14+
* @see <a href="https://www.rfc-editor.org/rfc/rfc9580.html#ec-curves">
15+
* RFC9580 - ECC Curves for OpenPGP</a>
16+
*/
1117
public static final ASN1ObjectIdentifier curvey25519 = ecc.branch("1");
1218
}

util/src/main/java/org/bouncycastle/asn1/gnu/GNUObjectIdentifiers.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public interface GNUObjectIdentifiers
6565
*/
6666
ASN1ObjectIdentifier Serpent_192_ECB = new ASN1ObjectIdentifier("1.3.6.1.4.1.11591.13.2.21"); // Serpent-192-ECB
6767
/**
68-
* 1.3.6.1.4.1.11591.13.2.22 -- Serpent-192-CCB
68+
* 1.3.6.1.4.1.11591.13.2.22 -- Serpent-192-CBC
6969
*/
7070
ASN1ObjectIdentifier Serpent_192_CBC = new ASN1ObjectIdentifier("1.3.6.1.4.1.11591.13.2.22"); // Serpent-192-CBC
7171
/**
@@ -107,5 +107,11 @@ public interface GNUObjectIdentifiers
107107
*/
108108
ASN1ObjectIdentifier ellipticCurve = new ASN1ObjectIdentifier("1.3.6.1.4.1.11591.15");
109109

110+
/**
111+
* Ed25519Legacy for use with EdDSALegacy.
112+
*
113+
* @see <a href="https://www.rfc-editor.org/rfc/rfc9580.html#ec-curves">
114+
* RFC9580 - ECC Curves for OpenPGP</a>
115+
*/
110116
ASN1ObjectIdentifier Ed25519 = ellipticCurve.branch("1");
111117
}

0 commit comments

Comments
 (0)