Skip to content

Commit

Permalink
Merge pull request #830 from SmithSamuelM/main
Browse files Browse the repository at this point in the history
Support for variable sized raw in Cipher with unit tests
  • Loading branch information
SmithSamuelM authored Jul 29, 2024
2 parents 4f5a028 + 4678826 commit ce3c235
Show file tree
Hide file tree
Showing 6 changed files with 472 additions and 159 deletions.
4 changes: 2 additions & 2 deletions src/keri/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

from .coring import Tholder
from .indexing import Indexer, Siger, IdrDex, IdxSigDex
from .signing import Signer, Salter, Cipher, Encrypter, Decrypter
from .counting import Counter, Codens
from .signing import Signer, Salter, Cipher, CiXDex, Encrypter, Decrypter
from .counting import Counter, Codens, CtrDex_2_0
111 changes: 1 addition & 110 deletions src/keri/core/coring.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,115 +465,6 @@ def __iter__(self):
TexDex = TextCodex() # Make instance


@dataclass(frozen=True)
class CipherX25519VarCodex:
"""
CipherX25519VarCodex is codex all variable sized cipher bytes derivation codes
for sealed box encryped ciphertext. Plaintext is B2.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via 'in' operator works.
"""
X25519_Cipher_L0: str = '4D' # X25519 sealed box cipher bytes of sniffable plaintext lead size 0
X25519_Cipher_L1: str = '5D' # X25519 sealed box cipher bytes of sniffable plaintext lead size 1
X25519_Cipher_L2: str = '6D' # X25519 sealed box cipher bytes of sniffable plaintext lead size 2
X25519_Cipher_Big_L0: str = '7AAD' # X25519 sealed box cipher bytes of sniffable plaintext big lead size 0
X25519_Cipher_Big_L1: str = '8AAD' # X25519 sealed box cipher bytes of sniffable plaintext big lead size 1
X25519_Cipher_Big_L2: str = '9AAD' # X25519 sealed box cipher bytes of sniffable plaintext big lead size 2

def __iter__(self):
return iter(astuple(self))


CiXVarDex = CipherX25519VarCodex() # Make instance


@dataclass(frozen=True)
class CipherX25519FixQB64Codex:
"""
CipherX25519FixQB64Codex is codex all fixed sized cipher bytes derivation codes
for sealed box encryped ciphertext. Plaintext is B64.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via 'in' operator works.
"""
X25519_Cipher_Seed: str = 'P' # X25519 sealed box 124 char qb64 Cipher of 44 char qb64 Seed
X25519_Cipher_Salt: str = '1AAH' # X25519 sealed box 100 char qb64 Cipher of 24 char qb64 Salt

def __iter__(self):
return iter(astuple(self))


CiXFixQB64Dex = CipherX25519FixQB64Codex() # Make instance


@dataclass(frozen=True)
class CipherX25519VarQB64Codex:
"""
CipherX25519VarQB64Codex is codex all variable sized cipher bytes derivation codes
for sealed box encryped ciphertext. Plaintext is QB64.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via 'in' operator works.
"""
X25519_Cipher_QB64_L0: str = '4D' # X25519 sealed box cipher bytes of QB64 plaintext lead size 0
X25519_Cipher_QB64_L1: str = '5E' # X25519 sealed box cipher bytes of QB64 plaintext lead size 1
X25519_Cipher_QB64_L2: str = '6E' # X25519 sealed box cipher bytes of QB64 plaintext lead size 2
X25519_Cipher_QB64_Big_L0: str = '7AAD' # X25519 sealed box cipher bytes of QB64 plaintext big lead size 0
X25519_Cipher_QB64_Big_L1: str = '8AAD' # X25519 sealed box cipher bytes of QB64 plaintext big lead size 1
X25519_Cipher_QB64_Big_L2: str = '9AAD' # X25519 sealed box cipher bytes of QB64 plaintext big lead size 2

def __iter__(self):
return iter(astuple(self))


CiXVarQB64Dex = CipherX25519VarQB64Codex() # Make instance


@dataclass(frozen=True)
class CipherX25519AllQB64Codex:
"""
CipherX25519AllQB64Codex is codex all both fixed and variable sized cipher bytes
derivation codes for sealed box encryped ciphertext. Plaintext is B64.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via 'in' operator works.
"""
X25519_Cipher_Seed: str = 'P' # X25519 sealed box 124 char qb64 Cipher of 44 char qb64 Seed
X25519_Cipher_Salt: str = '1AAH' # X25519 sealed box 100 char qb64 Cipher of 24 char qb64 Salt
X25519_Cipher_QB64_L0: str = '4D' # X25519 sealed box cipher bytes of QB64 plaintext lead size 0
X25519_Cipher_QB64_L1: str = '5E' # X25519 sealed box cipher bytes of QB64 plaintext lead size 1
X25519_Cipher_QB64_L2: str = '6E' # X25519 sealed box cipher bytes of QB64 plaintext lead size 2
X25519_Cipher_QB64_Big_L0: str = '7AAD' # X25519 sealed box cipher bytes of QB64 plaintext big lead size 0
X25519_Cipher_QB64_Big_L1: str = '8AAD' # X25519 sealed box cipher bytes of QB64 plaintext big lead size 1
X25519_Cipher_QB64_Big_L2: str = '9AAD' # X25519 sealed box cipher bytes of QB64 plaintext big lead size 2

def __iter__(self):
return iter(astuple(self))


CiXAllQB64Dex = CipherX25519AllQB64Codex() # Make instance


@dataclass(frozen=True)
class CipherX25519QB2VarCodex:
"""
CipherX25519QB2VarCodex is codex all variable sized cipher bytes derivation codes
for sealed box encryped ciphertext. Plaintext is B2.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via 'in' operator works.
"""
X25519_Cipher_L0: str = '4E' # X25519 sealed box cipher bytes of QB2 plaintext lead size 0
X25519_Cipher_L1: str = '5E' # X25519 sealed box cipher bytes of QB2 plaintext lead size 1
X25519_Cipher_L2: str = '6E' # X25519 sealed box cipher bytes of QB2 plaintext lead size 2
X25519_Cipher_Big_L0: str = '7AAE' # X25519 sealed box cipher bytes of QB2 plaintext big lead size 0
X25519_Cipher_Big_L1: str = '8AAE' # X25519 sealed box cipher bytes of QB2 plaintext big lead size 1
X25519_Cipher_Big_L2: str = '9AAE' # X25519 sealed box cipher bytes of QB2 plaintext big lead size 2

def __iter__(self):
return iter(astuple(self))


CiXVarQB2Dex = CipherX25519QB2VarCodex() # Make instance




@dataclass(frozen=True)
class NonTransCodex:
Expand Down Expand Up @@ -731,7 +622,7 @@ class Matter:
Names (dict): maps code to code name
Pad (str): B64 pad char for xtra size pre-padded soft values
Calss Methods:
Class Methods:
Attributes:
Expand Down
Loading

0 comments on commit ce3c235

Please sign in to comment.