You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -8,60 +8,68 @@ The following basic cryptography algorithms and parameters are used in the Power
8
8
9
9
### AES Symmetric Encryption
10
10
11
-
A symmetric key encryption algorithm, uses CBC mode of operation. It defines the following methods:
11
+
A symmetric key encryption algorithm. The AES algorithm is used with 256-bit keys.
12
+
13
+
- CTR mode is used as the encryption primitive inside AEAD and for unauthenticated key wrapping (UKE).
14
+
- GCM mode is used for local vault.
12
15
13
16
#### Encryption
14
17
15
-
Encrypt bytes using symmetric key with given initialization vector and `AES/CBC/PKCS7Padding` transformation:
18
+
Encrypt bytes using symmetric key with given initialization vector and `AES/CTR/NoPadding` transformation:
16
19
17
20
```java
18
21
byte[] encrypted =AES.encrypt(byte[] original, byte[] iv, SecretKey key);
19
22
```
20
23
21
-
Encrypt bytes using symmetric key with given initialization vector and given cipher transformation.
24
+
Encrypt bytes using symmetric key with given initialization vector and given cipher transformation:
22
25
23
26
```java
24
27
byte[] encrypted =AES.encrypt(byte[] original, byte[] iv, SecretKey key, String transformation);
25
28
```
26
29
27
30
#### Decryption
28
31
29
-
Decrypt bytes using symmetric key with given initialization vector and `AES/CBC/PKCS7Padding` transformation:
32
+
Decrypt bytes using symmetric key with given initialization vector and `AES/CTR/NoPadding` transformation:
30
33
31
34
```java
32
35
byte[] original =AES.decrypt(byte[] encrypted, byte[] iv, SecretKey key);
33
36
```
34
37
35
-
Decrypt bytes using symmetric key with given initialization vector and given cipher transformation.
38
+
Decrypt bytes using symmetric key with given initialization vector and given cipher transformation:
36
39
37
40
```java
38
41
byte[] original =AES.decrypt(byte[] encrypted, byte[] iv, SecretKey key, String transformation);
39
42
```
40
43
41
-
### PBKDF2
44
+
### Generic KDF
42
45
43
-
An algorithm for key stretching, converts a short password into long key by performing repeated hash iteration on the original data. HMAC-SHA1 algorithm is used for a pseudo-random function. Implementations must make sure resulting key is converted into a format usable by the AES algorithm.
46
+
Keys are derived from an original secret using hierarchical string labels to guarantee that derived keys are never reused for different purposes.
44
47
45
-
The following method will stretch the password using given number of iterations to achieve key of given length in bits. Use a provided salt value.
48
+
The following method is used to derive a key from original secret value:
46
49
47
50
```java
48
-
SecretKeyexpandedKey=PBKDF2.expand(char[] password, byte[] salt, long iterations, long lengthInBits);
byte[] bytes =KDF.deriveBytes(byte[] secret, String label, int length);
58
+
```
51
59
52
-
### X9.63 KDF with SHA256
60
+
### Password KDF
53
61
54
-
A standard KDF function based on X9.63, with SHA256 as an internal hash function. It uses iterations of SHA256 hash function to derive a key of expected `length` of bytes.
62
+
An algorithm for key stretching, converts a short password into long key by performing KMAC-based derivation on the original data.
55
63
56
-
Use the following method to derive a key of expected length from original secret value, using additional info byte value.
64
+
The following method will stretch the password using provided salt:
57
65
58
66
```java
59
-
byte[] bytes=KDF_X9_63_SHA256.derive(byte[] secret, byte[] info, int length);
An algorithm for elliptic curve Diffie-Hellman, uses P256r1 curve. We define a single operation on ECDH, a symmetric key deduction between parties A and B:
92
+
Post-quantum signature algorithm MLDSA can be used for post-quantum signatures.
85
93
86
-
Derive a shared secret using a private key of party A and a public key of party B using the follwing method.
94
+
A ML-DSA key pair is generated with a specified variant of the algorithm:
95
+
```java
96
+
KeyPair keyPair =MLDSA.generateKeyPair(String algorithm); // ML-DSA-65 or ML-DSA-87
97
+
```
87
98
99
+
A signature is created by signing the message raw bytes by private key from the ML-DSA keypair:
The resulting `SecretKey` represents the shared secret between parties.
130
+
131
+
### SharedSecret Interface
93
132
94
-
A key derivation function used to derive a symmetric key with specific "index" from a given master key. Uses `AES` algorithm with the zero initialization vector to derive the new key in following way: `index`is converted to bytes, XORed with a 16 byte long zero array (to get 16 byte long array with bytes from the index) and AES encrypted using provided symmetric key `masterKey`.
133
+
KEM is wrapped into a SharedSecret abstraction used by protocol flows.
95
134
96
-
To obtain a key derived from a master key using a provided index, use:
135
+
Client derives shared secret from server response:
97
136
98
137
```java
99
-
SecretKey derivedKey =KDF.derive(SecretKey masterKey, long index);
The interface internally uses `SharedSecretRequest`, `SharedSecretResponse`, and `SharedSecretClientContext` objects.
103
145
104
-
A second key derivation function for the algorithm internal purposes used to derive a symmetric key with specific "index" (in this case, `byte[16]`) from a given master key. Uses `HMAC-SHA256` to derive the new key in following way:
146
+
### UKE (Unauthenticated Key Encapsulation)
105
147
106
-
The `index`used as `HMAC-SHA256` key, provided symmetric key `masterKey` is converted to key bytes used as `HMAC-SHA256` data, resulting 32B long byte array is then XORed on per-byte basis (0th with 16th, 1st with 17th, etc.) to obtain 16B long byte array.
148
+
Primitive used for protecting factor-related keys (for example knowledge or biometry).
107
149
108
-
To obtain a key derived from a master key using a provided index, use:
150
+
UKE provides confidentiality without authentication and intentionally avoids authenticated encryption to prevent offline brute-force oracles on low-entropy secrets (such as PINs).
0 commit comments