Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New KDF for crypto4 #676

Open
romanstrobl opened this issue Jan 9, 2025 · 0 comments
Open

New KDF for crypto4 #676

romanstrobl opened this issue Jan 9, 2025 · 0 comments
Assignees

Comments

@romanstrobl
Copy link
Member

romanstrobl commented Jan 9, 2025

Description

New universal KDF uses KMAC-256 defined as:

  • byte[] Mac.kmac256(SecretKey key, byte[] data, byte[] custom, int outLength) where
    • key (K) is a key of any length
    • data (X) is the main input data. It may be of any length, including zero.
    • custom (S) is an optional customization string. Use UTF-8 to reinterpret string into bytes.
    • outLength (L) is an integer representing the requested output length in bytes.

Then KDF implementation is defined as:

  • SecretKey KDF.derive(SecretKey key, long index, byte[] context = null, int outLength = 32)
    • key - is key to be derived
    • index - is numeric index to distinguish multiple keys.
    • context - optional byte array containing the information related to the derived keying material
    • outLength - integer representing the requested output length in bytes.
  • Pseudocode:
      byte[] INDEX_BYTES = ByteUtils.encode(index);
    byte[] CTX;
    if (context != null) {
        CTX = ByteUtils.concat(INDEX_BYTES, ByteUtils.concatWithSizes(context));
    } else {
        CTX = INDEX_BYTES;
    }
    byte[] K_DERIVED = Mac.kmac256(key, CTX, "PA4KDF", outLength);

Cover the new KDF by tests.

Acceptance criteria

No response

Technical specification

No response

QA specification

No response

JIRA issue code

No response

@romanstrobl romanstrobl changed the title [Feature]: New KDF for Crypto4 [Feature]: New KDF for crypto4 Jan 9, 2025
@romanstrobl romanstrobl changed the title [Feature]: New KDF for crypto4 New KDF for crypto4 Jan 9, 2025
@romanstrobl romanstrobl self-assigned this Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant