Skip to content

Commit 3124140

Browse files
committed
chore: merge branch 'release/v2.0.0'
2 parents 8f2a391 + 37ef99e commit 3124140

44 files changed

Lines changed: 1076 additions & 2724 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.classpath

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
<attribute name="m2e-apt" value="true"/>
3838
</attributes>
3939
</classpathentry>
40+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
41+
<attributes>
42+
<attribute name="maven.pomderived" value="true"/>
43+
</attributes>
44+
</classpathentry>
4045
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
4146
<attributes>
4247
<attribute name="optional" value="true"/>

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ hs_err_*.log
55
project/
66
.settings/org.*
77
.project
8+
cloudproof_java.code-workspace

.vscode/settings.json

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
{
2-
"java.configuration.updateBuildConfiguration": "automatic",
3-
"cSpell.words": [
4-
"ciphertext",
5-
"Cosmian",
6-
"Deserialization",
7-
"deserializers",
8-
"instanceof",
9-
"Kmip",
10-
"serializers"
11-
],
12-
"java.format.settings.url": ".vscode/codestyle-java.xml",
13-
"[java]": {
14-
"editor.detectIndentation": false,
15-
"editor.insertSpaces": true,
16-
"editor.tabSize": 4,
17-
},
18-
"files.watcherExclude": {
19-
"**/target": true
20-
}
2+
"java.configuration.updateBuildConfiguration": "automatic",
3+
"cSpell.words": [
4+
"ciphertext",
5+
"Cloudproof",
6+
"cosmian",
7+
"Cosmian",
8+
"Deserialization",
9+
"deserializers",
10+
"instanceof",
11+
"kmip",
12+
"Kmip",
13+
"serializers"
14+
],
15+
"java.format.settings.url": ".vscode/codestyle-java.xml",
16+
"[java]": {
17+
"editor.detectIndentation": false,
18+
"editor.insertSpaces": true,
19+
"editor.tabSize": 4
20+
},
21+
"files.watcherExclude": {
22+
"**/target": true
23+
}
2124
}

CHANGELOG.md

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

33
All notable changes to this project will be documented in this file.
44

5+
## [2.0.0] - 2022-11-15
6+
7+
### Added
8+
9+
### Changed
10+
11+
- updated CoverCrypt to 7 and Findex to 0.10
12+
13+
### Fixed
14+
15+
### Removed
16+
517
## [1.11.2] - 2022-10-16
618

719
### Added

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ This library is free software and is available on Maven Central
2727
<dependency>
2828
<groupId>com.cosmian</groupId>
2929
<artifactId>cloudproof_java</artifactId>
30-
<version>1.11.2</version>
30+
<version>2.0.0</version>
3131
</dependency>
3232
```
3333

3434
## Versions Correspondence
3535

3636
When using local encryption and decryption with [GPSW](https://github.com/Cosmian/abe_gpsw) and [CoverCrypt](https://github.com/Cosmian/cover_crypt), native libraries are required.
3737

38-
Check the main pages of the respective projects to build the native librairies appropriate for your systems. The [test directory](./src/test/resources/linux-x86-64/) provides pre-built libraries for Linux GLIBC 2.17. These librairies should run fine on a system with a more recent GLIBC version.
38+
Check the main pages of the respective projects to build the native libraries appropriate for your systems. The [test directory](./src/test/resources/linux-x86-64/) provides pre-built libraries for Linux GLIBC 2.17. These librairies should run fine on a system with a more recent GLIBC version.
3939

4040
This table shows the minimum versions correspondences between the various components
4141

4242
| KMS Server | Java Lib | GPSW lib | CoverCrypt lib | Findex |
43-
|------------|-----------|-----------|----------------|--------|
43+
| ---------- | --------- | --------- | -------------- | ------ |
4444
| 1.2.0 | 0.5.0 | 0.3.0 | N/A | N/A |
4545
| 1.2.1 | 0.5.2 | 0.4.0 | N/A | N/A |
4646
| 1.2.1 | ~~0.6.0~~ | ~~0.6.0~~ | N/A | N/A |
@@ -53,6 +53,7 @@ This table shows the minimum versions correspondences between the various compon
5353
| 2.2.0 | 0.10.1 | 2.0.1 | 6.0.1 | 0.6.1 |
5454
| 2.2.0 | 0.11.0 | 2.0.1 | 6.0.1 | 0.7.0 |
5555
| 2.3.0 | 1.11.0 | 2.0.1 | 6.0.1 | 0.7.0 |
56+
| 3.0.0 | 2.0.0 | N/A | 7.0.2 | 0.10.0 |
5657

5758
## Update native libraries
5859

pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.cosmian</groupId>
55
<artifactId>cloudproof_java</artifactId>
6-
<version>1.11.2</version>
6+
<version>2.0.0</version>
77

88
<name>cloudproof_java</name>
99
<description>The Cloudproof Java Lib secures data repositories in the cloud with attributes-based access control encryption and encrypted search</description>
1010
<url>https://github.com/Cosmian/cloudproof_java</url>
1111
<licenses>
1212
<license>
13-
<name>MIT</name>
14-
<url>https://mit-license.org/</url>
13+
<name>Dual License</name>
1514
<distribution>repo</distribution>
1615
</license>
1716
</licenses>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package com.cosmian;
2+
3+
import java.io.IOException;
4+
import java.io.InputStream;
5+
import java.io.OutputStream;
6+
7+
public class Leb128 {
8+
9+
final static Long MASK = 127L;
10+
11+
final static Long HIGH_ORDER_BIT = 128L;
12+
13+
/**
14+
* Write a u64 as an LEB128
15+
*
16+
* @param os the {@link OutputStream} to write to
17+
* @param value the value to write
18+
* @throws IOException if the stream is in error
19+
*/
20+
public static void writeU64(OutputStream os, long value) throws IOException {
21+
22+
while (value != 0) {
23+
24+
long b = value & MASK;
25+
value = value >>> 7;
26+
if (value != 0) {
27+
b = b | HIGH_ORDER_BIT;
28+
}
29+
os.write((int) b & 0xFF);
30+
}
31+
}
32+
33+
/**
34+
* Read an u64 encoded as an LEB 128 from a stream
35+
*
36+
* @param is the {@link InputStream} to read from
37+
* @return the long value
38+
* @throws IOException if the stream is in error
39+
*/
40+
public static long readU64(InputStream is) throws IOException {
41+
int shift = 0;
42+
long result = 0;
43+
44+
boolean last;
45+
do {
46+
long b = is.read();
47+
last = (b & HIGH_ORDER_BIT) != HIGH_ORDER_BIT;
48+
b = b & MASK;
49+
result |= (b << shift);
50+
shift += 7;
51+
} while (!last);
52+
return result;
53+
}
54+
55+
/**
56+
* Read a byte array prepended with a LEB 128 u64 indicated its length Warning: the maximum array size is 2^31
57+
*
58+
* @param is the {@link InputStream} to read the array from
59+
* @return the byte array
60+
* @throws IOException if the stream is in error or the number of bytes read is not the expected value
61+
*/
62+
public static byte[] readByteArray(InputStream is) throws IOException {
63+
long length = readU64(is);
64+
byte[] buffer = new byte[(int) length];
65+
int actualLength = is.read(buffer);
66+
if (actualLength != length) {
67+
throw new IOException(
68+
"Error reading a byte array of " + length + " bytes: only " + actualLength + " bytes were read !");
69+
}
70+
return buffer;
71+
}
72+
73+
/**
74+
* Write a byte array prepended with a LEB128 u64 indicating its length
75+
*
76+
* @param os the {@link OutputStream} to write to
77+
* @param array the array to write
78+
* @throws IOException is the stream is in error
79+
*/
80+
public static void writeArray(OutputStream os, byte[] array) throws IOException {
81+
writeU64(os, (long) array.length);
82+
os.write(array);
83+
}
84+
85+
}

src/main/java/com/cosmian/jna/abe/DecryptedHeader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ public class DecryptedHeader {
44

55
private final byte[] symmetricKey;
66

7-
private final byte[] uid;
7+
private final byte[] authenticationData;
88

99
private final byte[] additionalData;
1010

11-
public DecryptedHeader(byte[] symmetricKey, byte[] uid, byte[] additional_data) {
11+
public DecryptedHeader(byte[] symmetricKey, byte[] authenticationData, byte[] additional_data) {
1212
this.symmetricKey = symmetricKey;
13-
this.uid = uid;
13+
this.authenticationData = authenticationData;
1414
this.additionalData = additional_data;
1515
}
1616

@@ -19,7 +19,7 @@ public byte[] getSymmetricKey() {
1919
}
2020

2121
public byte[] getUid() {
22-
return this.uid;
22+
return this.authenticationData;
2323
}
2424

2525
public byte[] getAdditionalData() {

0 commit comments

Comments
 (0)