or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

async-operations.mdcomponent-lifecycle.mdcore-utilities.mddata-structures.mdindex.mdresource-management.mdsecurity.mdstatistics.mdthreading.md

security.mddocs/

0

# Security

1

2

Comprehensive security utilities including SSL/TLS context management, credential providers, and certificate utilities for secure server applications.

3

4

## Capabilities

5

6

### SslContextFactory

7

8

SSL context configuration and management for secure connections.

9

10

```java { .api }

11

/**

12

* SSL context factory and configuration

13

*/

14

public abstract class SslContextFactory extends ContainerLifeCycle {

15

/** Create new SSL engine */

16

public abstract SSLEngine newSSLEngine();

17

18

/** Create SSL engine for specific host/port */

19

public abstract SSLEngine newSSLEngine(String host, int port);

20

21

/** Customize SSL engine settings */

22

public abstract void customize(SSLEngine sslEngine);

23

24

/** Reload SSL configuration */

25

public void reload(Consumer<SslContextFactory> consumer) throws Exception;

26

27

/** Get SSL context */

28

public SSLContext getSslContext();

29

30

/** Check if SSL is available */

31

public boolean isSslAvailable();

32

}

33

```

34

35

### Credential Management

36

37

```java { .api }

38

/**

39

* Credential provider interface

40

*/

41

public interface CredentialProvider {

42

/** Get credential for given credential string */

43

Credential getCredential(String credential);

44

}

45

46

/**

47

* Base credential class

48

*/

49

public abstract class Credential {

50

/** Check credential against object */

51

public abstract boolean check(Object credentials);

52

53

/** Get credential from string */

54

public static Credential getCredential(String credential);

55

}

56

57

/**

58

* Password credential implementation

59

*/

60

public class Password extends Credential {

61

/** Create password from string */

62

public Password(String password);

63

64

/** Obfuscate password string */

65

public static String obfuscate(String password);

66

67

/** Deobfuscate password string */

68

public static String deobfuscate(String obfuscated);

69

}

70

```

71

72

### Certificate Utilities

73

74

```java { .api }

75

/**

76

* X.509 certificate utilities

77

*/

78

public class CertificateUtils {

79

/** Get certificate chain from keystore */

80

public static X509Certificate[] getCertChain(KeyStore keyStore, String alias);

81

82

/** Get key alias for certificate */

83

public static String getKeyAlias(KeyStore keyStore, X509Certificate cert);

84

85

/** Validate certificate chain */

86

public static void validateCertificateChain(X509Certificate[] chain);

87

}

88

89

/**

90

* Certificate validator */

91

public class CertificateValidator {

92

/** Validate certificate */

93

public boolean validate(X509Certificate[] chain, String authType);

94

}

95

```

96

97

**Usage Examples:**

98

99

```java

100

import org.eclipse.jetty.util.security.*;

101

import org.eclipse.jetty.util.ssl.*;

102

103

// Password handling

104

Password password = new Password("secret123");

105

String obfuscated = Password.obfuscate("secret123");

106

String deobfuscated = Password.deobfuscate(obfuscated);

107

108

// Credential checking

109

boolean valid = password.check("secret123");

110

111

// Certificate operations

112

KeyStore keyStore = KeyStore.getInstance("JKS");

113

X509Certificate[] chain = CertificateUtils.getCertChain(keyStore, "server");

114

String alias = CertificateUtils.getKeyAlias(keyStore, chain[0]);

115

```