Skip to content

Commit ce3d493

Browse files
author
Hugo Rosenkranz-Costa
authored
feat: update covercrypt to v12.0 (#35)
* feat: update covercrypt to v12.0
1 parent f61d2dd commit ce3d493

6 files changed

Lines changed: 18 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
77
### Features
88

99
- Update to findex 5.0.0
10+
- Update to covercrypt 12.0.0
1011
- Support KMS v4.5.0 with tagging support
1112

1213
## [4.0.2] - 2023-07-17

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ classifiers = [
1818
]
1919
dependencies = [
2020
"cloudproof-anonymization >= 0.1.0, < 1.0.0",
21-
"cover-crypt >= 11.0.0, < 12.0.0",
21+
"cover-crypt >= 12.0.0, < 13.0.0",
2222
"findex >= 5.0.0, < 6.0.0",
2323
"cosmian-kms >= 4.5.0, < 5.0.0",
2424
"cloudproof-fpe >= 0.1.0, < 1.0.0",

src/cloudproof_py/cover_crypt/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
from cloudproof_cover_crypt import (
33
Attribute,
44
CoverCrypt,
5+
MasterPublicKey,
56
MasterSecretKey,
67
Policy,
78
PolicyAxis,
8-
PublicKey,
99
SymmetricKey,
1010
UserSecretKey,
1111
)
@@ -17,6 +17,6 @@
1717
"CoverCrypt",
1818
"SymmetricKey",
1919
"MasterSecretKey",
20-
"PublicKey",
20+
"MasterPublicKey",
2121
"UserSecretKey",
2222
]

src/cloudproof_py/kms/__init__.py

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

44
from cloudproof_cover_crypt import (
55
Attribute,
6+
MasterPublicKey,
67
MasterSecretKey,
78
Policy,
8-
PublicKey,
99
UserSecretKey,
1010
)
1111
from cosmian_kms import KmsClient as InternalKmsClient
@@ -114,17 +114,17 @@ async def cover_crypt_decryption(
114114

115115
async def retrieve_cover_crypt_public_master_key(
116116
self, public_key_identifier: str
117-
) -> PublicKey:
117+
) -> MasterPublicKey:
118118
"""Fetch a CoverCrypt Public Master key.
119119
120120
Args:
121121
public_key_identifier (str): the key unique identifier in the KMS
122122
123123
Returns:
124-
PublicKey
124+
MasterPublicKey
125125
"""
126126
object = await super().get_object(public_key_identifier)
127-
return PublicKey.from_bytes(object.key_block())
127+
return MasterPublicKey.from_bytes(object.key_block())
128128

129129
async def retrieve_cover_crypt_private_master_key(
130130
self, master_secret_key_identifier: str

tests/non_regression_cover_crypt.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# -*- coding: utf-8 -*-
2+
import argparse
23
import json
3-
from base64 import b64encode, b64decode
4-
from typing import Union
54
import os
6-
import argparse
5+
from base64 import b64decode, b64encode
6+
from typing import Union
77

88
from cloudproof_py.cover_crypt import (
9-
Policy,
10-
PolicyAxis,
119
CoverCrypt,
10+
MasterPublicKey,
1211
MasterSecretKey,
13-
PublicKey,
12+
Policy,
13+
PolicyAxis,
1414
UserSecretKey,
1515
)
1616

@@ -40,7 +40,7 @@ def generate_user(
4040

4141
def generate_ciphertext(
4242
instance: CoverCrypt,
43-
public_key: PublicKey,
43+
public_key: MasterPublicKey,
4444
policy: Policy,
4545
access_policy: str,
4646
plaintext: bytes,
@@ -183,7 +183,7 @@ def test_non_regression_vector(vector: dict) -> None:
183183
#
184184
Policy.from_bytes(b64decode(vector["policy"]))
185185
MasterSecretKey.from_bytes(b64decode(vector["master_secret_key"]))
186-
PublicKey.from_bytes(b64decode(vector["public_key"]))
186+
MasterPublicKey.from_bytes(b64decode(vector["public_key"]))
187187

188188
#
189189
# Decrypt with top secret fin key

tests/test_cover_crypt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from cloudproof_py.cover_crypt import (
55
Attribute,
66
CoverCrypt,
7+
MasterPublicKey,
78
MasterSecretKey,
89
Policy,
910
PolicyAxis,
10-
PublicKey,
1111
UserSecretKey,
1212
)
1313
from cloudproof_py.kms import KmsClient
@@ -314,7 +314,7 @@ async def test_combined_kms_native(self) -> None:
314314
pubkey = await self.client.retrieve_cover_crypt_public_master_key(
315315
self.pubkey_uid
316316
)
317-
self.assertIsInstance(pubkey, PublicKey)
317+
self.assertIsInstance(pubkey, MasterPublicKey)
318318

319319
# Retrieve private key
320320
privkey = await self.client.retrieve_cover_crypt_private_master_key(

0 commit comments

Comments
 (0)