Skip to content

Commit 33c9513

Browse files
docs: JavaDoc (#196)
Added JavaDoc comments to multiple classes and methods across the SDK, providing detailed descriptions of their functionality and usage. This enhances the readability and maintainability of the code. DSP-119
1 parent 210a157 commit 33c9513

23 files changed

+150
-4
lines changed

sdk/src/main/java/io/opentdf/platform/sdk/AesGcm.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
import java.security.NoSuchAlgorithmException;
1313
import java.security.SecureRandom;
1414

15+
/**
16+
* The AesGcm class provides encryption and decryption methods using AES-GCM mode.
17+
* It includes methods to encrypt and decrypt byte arrays using a specified
18+
* symmetric key.
19+
*/
1520
public class AesGcm {
1621
public static final int GCM_NONCE_LENGTH = 12; // in bytes
1722
public static final int GCM_TAG_LENGTH = 16; // in bytes

sdk/src/main/java/io/opentdf/platform/sdk/AssertionConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
import java.util.Objects;
55

6+
/**
7+
* Represents the configuration for assertions, encapsulating various types, scopes, states, keys,
8+
* and statements involved in assertion handling.
9+
*/
610
public class AssertionConfig {
711

812
public enum Type {

sdk/src/main/java/io/opentdf/platform/sdk/AsymDecryption.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import java.security.spec.PKCS8EncodedKeySpec;
1010
import java.util.Base64;
1111

12+
/**
13+
* Class providing functionality for asymmetric decryption using an RSA private key.
14+
*/
1215
public class AsymDecryption {
1316
private final PrivateKey privateKey;
1417
private static final String PRIVATE_KEY_HEADER = "-----BEGIN PRIVATE KEY-----";

sdk/src/main/java/io/opentdf/platform/sdk/AsymEncryption.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
import java.util.Base64;
1616
import java.util.Objects;
1717

18+
/**
19+
* AsymEncryption class provides methods for asymmetric encryption and
20+
* handling public keys in PEM format.
21+
*/
1822
public class AsymEncryption {
1923
private final PublicKey publicKey;
2024
private static final String PUBLIC_KEY_HEADER = "-----BEGIN PUBLIC KEY-----";

sdk/src/main/java/io/opentdf/platform/sdk/AutoConfigureException.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package io.opentdf.platform.sdk;
22

3+
/**
4+
* Exception thrown when automatic configuration fails.
5+
*/
36
public class AutoConfigureException extends RuntimeException {
47
public AutoConfigureException(String message) {
58
super(message);

sdk/src/main/java/io/opentdf/platform/sdk/Autoconfigure.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535
import java.util.regex.Pattern;
3636
import java.util.stream.Collectors;
3737

38-
// Attribute rule types: operators!
38+
/**
39+
* The RuleType class defines a set of constants that represent various types of attribute rules.
40+
* These constants are used to specify the nature and behavior of attribute rules in the context
41+
* of key management and policy enforcement.
42+
*/
3943
class RuleType {
4044
public static final String HIERARCHY = "hierarchy";
4145
public static final String ALL_OF = "allOf";
@@ -44,6 +48,12 @@ class RuleType {
4448
public static final String EMPTY_TERM = "DEFAULT";
4549
}
4650

51+
/**
52+
* The Autoconfigure class provides methods for configuring and retrieving
53+
* grants related to attribute values and KAS (Key Access Server) keys.
54+
* This class includes functionality to create granter instances based on
55+
* attributes either from a list of attribute values or from a service.
56+
*/
4757
public class Autoconfigure {
4858

4959
public static Logger logger = LoggerFactory.getLogger(Autoconfigure.class);

sdk/src/main/java/io/opentdf/platform/sdk/Config.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
import java.util.*;
1111
import java.util.function.Consumer;
1212

13+
/**
14+
* Configuration class for setting various configurations related to TDF.
15+
* Contains nested classes and enums for specific configuration settings.
16+
*/
1317
public class Config {
1418

1519
public static final int TDF3_KEY_SIZE = 2048;

sdk/src/main/java/io/opentdf/platform/sdk/CryptoUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import java.security.*;
66
import java.util.Base64;
77

8+
/**
9+
* Utility class for cryptographic operations such as generating RSA key pairs and calculating HMAC.
10+
*/
811
public class CryptoUtils {
912
private static final int KEYPAIR_SIZE = 2048;
1013

sdk/src/main/java/io/opentdf/platform/sdk/InvalidZipException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package io.opentdf.platform.sdk;
22

3+
/**
4+
* InvalidZipException is thrown to indicate that a ZIP file being read
5+
* is invalid or corrupted in some way. This exception extends RuntimeException,
6+
* allowing it to be thrown during the normal operation of the Java Virtual Machine.
7+
*/
38
public class InvalidZipException extends RuntimeException {
49
public InvalidZipException(String message) {
510
super(message);

sdk/src/main/java/io/opentdf/platform/sdk/KASClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030

3131
import static java.lang.String.format;
3232

33+
/**
34+
* A client implementation that communicates with a Key Access Service (KAS).
35+
* This class provides methods to retrieve public keys, unwrap encrypted keys,
36+
* and manage key caches.
37+
*/
3338
public class KASClient implements SDK.KAS {
3439

3540
private final Function<String, ManagedChannel> channelFactory;

0 commit comments

Comments
 (0)