Skip to content

Commit

Permalink
Merge branch 'release/v3.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuthor committed Oct 21, 2022
2 parents f4e3f8a + c43351a commit c09e08f
Show file tree
Hide file tree
Showing 13 changed files with 99 additions and 43 deletions.
15 changes: 15 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ build_node_18:
extends: .test
image: node:18

# cloudproof_js_demo:
# stage: prebuild
# # stage: pack
# before_script:
# - npm install -g typescript
# script:
# - npm install
# - git clone --branch fix/packaging http://gitlab.cosmian.com/core/cloudproof_js_demo.git
# - cd cloudproof_js_demo
# # - npm install || true
# - npm install .. --save
# - cat package.json
# - npx webpack
# allow_failure: true

pack:
stage: pack
before_script:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

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


---

## [3.2.2] - 2022-10-21

### Added

### Changed

- update findex to 0.8.0

### Fixed


### Removed

---

## [3.2.1] - 2022-10-19
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudproof_js",
"version": "3.2.1",
"version": "3.2.2",
"license": "MIT",
"description": "Cosmian Cloudproof javascript client library",
"main": "dist/src/index.js",
Expand All @@ -21,7 +21,7 @@
"dependencies": {
"@types/uuid": "^8.3.4",
"cosmian_cover_crypt": "^6.0.8",
"cosmian_findex": "^0.7.2",
"cosmian_findex": "^0.8.0",
"js-crypto-hmac": "^1.0.4",
"leb128": "0.0.5",
"process": "^0.11.10",
Expand Down
5 changes: 3 additions & 2 deletions src/crypto/abe/core/hybrid_crypto/cover_crypt/decryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export class CoverCryptHybridDecryption {
return this._asymmetricDecryptionKey
}


public renewKey(userDecryptionKey: Uint8Array): void {
this.asymmetricDecryptionKey = userDecryptionKey
}
Expand Down Expand Up @@ -106,7 +105,9 @@ export class CoverCryptHybridDecryption {

// HEADER decryption: asymmetric decryption
const cleartextHeader = this.decryptHybridHeader(asymmetricHeader)
logger.log(() => `decrypt for cleartextHeader: ${JSON.stringify(cleartextHeader)}`)
logger.log(
() => `decrypt for cleartextHeader: ${JSON.stringify(cleartextHeader)}`
)

// AES_DATA: AES Symmetric part decryption
const cleartext = this.decryptHybridBlock(
Expand Down
18 changes: 13 additions & 5 deletions src/crypto/abe/core/hybrid_crypto/cover_crypt/encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export class CoverCryptHybridEncryption {
this.publicKey
)

logger.log(() => `hybrid header succeeded: ${hexEncode(encryptedHeaderBytes)}`)
logger.log(
() => `hybrid header succeeded: ${hexEncode(encryptedHeaderBytes)}`
)

return EncryptedHeader.parseLEB128(encryptedHeaderBytes)
}
Expand Down Expand Up @@ -118,7 +120,7 @@ export class CoverCryptHybridEncryption {
uid: Uint8Array,
plaintext: Uint8Array
): Uint8Array {
logger.log(() => `encrypt for attributes: ${attributes.join(',' )}`)
logger.log(() => `encrypt for attributes: ${attributes.join(",")}`)
logger.log(() => `encrypt for uid: ${hexEncode(uid)}`)
logger.log(() => `encrypt for plaintext: ${hexEncode(plaintext)}`)

Expand All @@ -130,7 +132,9 @@ export class CoverCryptHybridEncryption {
const hybridHeader = this.encryptHybridHeader(encryptionParameters)
logger.log(
() =>
`encrypt: encryptedSymmetricKeySizeAsArray:${hexEncode(hybridHeader.encryptedSymmetricKeySizeAsArray)}`
`encrypt: encryptedSymmetricKeySizeAsArray:${hexEncode(
hybridHeader.encryptedSymmetricKeySizeAsArray
)}`
)
const ciphertext = this.encryptHybridBlock(
hybridHeader.symmetricKey,
Expand All @@ -141,15 +145,19 @@ export class CoverCryptHybridEncryption {

logger.log(
() =>
`encrypt: header size : ${hexEncode(hybridHeader.encryptedSymmetricKeySizeAsArray)}`
`encrypt: header size : ${hexEncode(
hybridHeader.encryptedSymmetricKeySizeAsArray
)}`
)
logger.log(
() =>
`encrypt: enc header size : ${hybridHeader.encryptedSymmetricKey.length}`
)
logger.log(
() =>
`encrypt: encrypted symmetric key : ${hexEncode(hybridHeader.encryptedSymmetricKey)}`
`encrypt: encrypted symmetric key : ${hexEncode(
hybridHeader.encryptedSymmetricKey
)}`
)
logger.log(() => `encrypt: ciphertext : ${hexEncode(ciphertext)}`)

Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export * from "./crypto/sse/findex/simple"
export { CoverCryptHybridDecryption } from "./crypto/abe/core/hybrid_crypto/cover_crypt/decryption"
export { CoverCryptHybridEncryption } from "./crypto/abe/core/hybrid_crypto/cover_crypt/encryption"
export { CoverCryptKeyGeneration } from "./crypto/abe/core/keygen/cover_crypt"
export {
CoverCryptKeyGeneration,
CoverCryptMasterKey,
} from "./crypto/abe/core/keygen/cover_crypt"
export * from "./crypto/abe/interfaces/encryption_parameters"
export * from "./crypto/abe/interfaces/access_policy"
export * from "./crypto/abe/interfaces/cleartext_header"
Expand Down
6 changes: 5 additions & 1 deletion tests/abe/hybrid_crypto_utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/* tslint:disable:max-classes-per-file */

import { CoverCryptHybridDecryption, CoverCryptHybridEncryption, CoverCryptKeyGeneration } from "index"
import {
CoverCryptHybridDecryption,
CoverCryptHybridEncryption,
CoverCryptKeyGeneration,
} from "index"
import { Policy, PolicyAxis } from "../../src/crypto/abe/interfaces/policy"
import { logger } from "../../src/utils/logger"
import { hexEncode } from "../../src/utils/utils"
Expand Down
31 changes: 20 additions & 11 deletions tests/findex/findex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@ import { hexEncode } from "../../src/utils/utils"
import { randomBytes } from "crypto"
import sqlite3 = require("sqlite3")


test("upsert and search memory", async () => {
const entryLocation: IndexedEntry = {
indexedValue: IndexedValue.fromLocation(new Location(new TextEncoder().encode("ROBERT file"))),
keywords: new Set([new Keyword(new TextEncoder().encode("ROBERT"))])
indexedValue: IndexedValue.fromLocation(
new Location(new TextEncoder().encode("ROBERT file"))
),
keywords: new Set([new Keyword(new TextEncoder().encode("ROBERT"))]),
}
const entryLocation_ = new LocationIndexEntry("ROBERT file", ["ROBERT"])
expect(entryLocation_).toEqual(entryLocation)

const entryKeyword: IndexedEntry = {
indexedValue: IndexedValue.fromNextWord(new Keyword(new TextEncoder().encode("ROBERT"))),
keywords: new Set([new Keyword(new TextEncoder().encode("BOB"))])
indexedValue: IndexedValue.fromNextWord(
new Keyword(new TextEncoder().encode("ROBERT"))
),
keywords: new Set([new Keyword(new TextEncoder().encode("BOB"))]),
}
const entryKeyword_ = new KeywordIndexEntry("BOB", "ROBERT")
expect(entryKeyword_).toEqual(entryKeyword)
Expand All @@ -46,7 +49,9 @@ test("upsert and search memory", async () => {
const entryTable: { [uid: string]: Uint8Array } = {}
const chainTable: { [uid: string]: Uint8Array } = {}

const fetchEntries: FetchEntries = async (uids: Uint8Array[]): Promise<UidsAndValues> => {
const fetchEntries: FetchEntries = async (
uids: Uint8Array[]
): Promise<UidsAndValues> => {
const results: UidsAndValues = []
for (const uid of uids) {
const value = entryTable[hexEncode(uid)]
Expand All @@ -57,7 +62,9 @@ test("upsert and search memory", async () => {
return await Promise.resolve(results)
}

const fetchChains: FetchChains = async (uids: Uint8Array[]): Promise<UidsAndValues> => {
const fetchChains: FetchChains = async (
uids: Uint8Array[]
): Promise<UidsAndValues> => {
const results: UidsAndValues = []
for (const uid of uids) {
const value = chainTable[hexEncode(uid)]
Expand All @@ -68,22 +75,24 @@ test("upsert and search memory", async () => {
return await Promise.resolve(results)
}


const upsertEntries: UpsertEntries = async (uidsAndValues: UidsAndValues): Promise<void> => {
const upsertEntries: UpsertEntries = async (
uidsAndValues: UidsAndValues
): Promise<void> => {
for (const { uid, value } of uidsAndValues) {
entryTable[hexEncode(uid)] = value
}
return await Promise.resolve()
}

const upsertChains: UpsertChains = async (uidsAndValues: UidsAndValues): Promise<void> => {
const upsertChains: UpsertChains = async (
uidsAndValues: UidsAndValues
): Promise<void> => {
for (const { uid, value } of uidsAndValues) {
chainTable[hexEncode(uid)] = value
}
return await Promise.resolve()
}


await upsert(
[entryLocation, entryKeyword],
searchKey,
Expand Down
2 changes: 1 addition & 1 deletion tests/wasm_lib/cosmian_findex/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The library is made available under two different licenses depending on how you plan to use it.

# Open Source License
The library is made available under an Affero GPLv3 license for open-source, academic, and personal projects.
The library is made available under an Affero GPLv3 license for open-source, academic, technology evaluation, and personal projects.
A copy of this license is available below.

# Commercial License
Expand Down
6 changes: 3 additions & 3 deletions tests/wasm_lib/cosmian_findex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ cargo build --release
To build the FFI Cosmian interfaces:

```
cargo build --release ffi
cargo build --release --features ffi
```

To build the WebAssembly interface:
```
cargo build --release wasm_bindgen
cargo build --release --features wasm_bindgen
```

And finally, to build everything and test it, run:
Expand Down Expand Up @@ -265,7 +265,7 @@ Searches: as an average, the search of a word (part or full) will return a numbe
- `martin` -> {locations}
- `martine` -> {locations}

*Graphs*:
*Graphs*:
- `mar` -> `mart`
- `mart` -> `marti`
- `marti` -> `martin`
Expand Down
32 changes: 16 additions & 16 deletions tests/wasm_lib/cosmian_findex/cosmian_findex.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,6 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
return addHeapObject(ret);
};

module.exports.__wbindgen_boolean_get = function(arg0) {
const v = getObject(arg0);
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
return ret;
};

module.exports.__wbindgen_cb_drop = function(arg0) {
const obj = takeObject(arg0).original;
if (obj.cnt-- == 1) {
Expand All @@ -225,6 +219,20 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
return ret;
};

module.exports.__wbindgen_boolean_get = function(arg0) {
const v = getObject(arg0);
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
return ret;
};

module.exports.__wbg_randomFillSync_065afffde01daa66 = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
}, arguments) };

module.exports.__wbg_getRandomValues_b99eec4244a475bb = function() { return handleError(function (arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
}, arguments) };

module.exports.__wbg_process_0cc2ada8524d6f83 = function(arg0) {
const ret = getObject(arg0).process;
return addHeapObject(ret);
Expand Down Expand Up @@ -271,14 +279,6 @@ module.exports.__wbg_require_a746e79b322b9336 = function() { return handleError(
return addHeapObject(ret);
}, arguments) };

module.exports.__wbg_getRandomValues_b99eec4244a475bb = function() { return handleError(function (arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
}, arguments) };

module.exports.__wbg_randomFillSync_065afffde01daa66 = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
}, arguments) };

module.exports.__wbg_newnoargs_b5b063fc6c2f0376 = function(arg0, arg1) {
const ret = new Function(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
Expand Down Expand Up @@ -401,8 +401,8 @@ module.exports.__wbindgen_memory = function() {
return addHeapObject(ret);
};

module.exports.__wbindgen_closure_wrapper285 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 75, __wbg_adapter_22);
module.exports.__wbindgen_closure_wrapper289 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 79, __wbg_adapter_22);
return addHeapObject(ret);
};

Expand Down
Binary file modified tests/wasm_lib/cosmian_findex/cosmian_findex_bg.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/wasm_lib/cosmian_findex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"Emmanuel Coste <[email protected]>"
],
"description": "Symmetric Searchable Encryption",
"version": "0.7.2",
"version": "0.8.0",
"license": "MIT/Apache-2.0",
"repository": {
"type": "git",
Expand Down

0 comments on commit c09e08f

Please sign in to comment.