Skip to content

Commit 5f738a5

Browse files
committed
Clean up class structure
1 parent 5066d45 commit 5f738a5

File tree

1 file changed

+116
-43
lines changed

1 file changed

+116
-43
lines changed

draft-dijkhuis-cfrg-hdkeys.md

+116-43
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ Step 4 MAY be postponed to be combined with step 6. Steps 5 to 8 MAY be combined
407407

408408
## Using digital signatures
409409

410-
Instantiations of HDK using digital signatures require the following cryptographic constructs:
410+
Instantiations of HDK using digital signatures require:
411411

412412
- `DSA`: A digital signature algorithm, consisting of the functions:
413413
- GenerateKeyPair(): Outputs a new key pair `(sk, pk)` consisting of private key `sk` and public key `pk`.
@@ -433,7 +433,7 @@ msg = create_message(pk, nonce) # out of scope for this spec
433433
Verify(signature, pk, msg)
434434
~~~
435435

436-
Instantiations of HDK using digital signatures instantiat the following:
436+
Instantiations of HDK using digital signatures provide:
437437

438438
- `BL`: A cryptographic construct that extends `DSA` as specified in [I-D.draft-irtf-cfrg-signature-key-blinding-07], implementing the interface from [Instantiation parameters](#instantiation-parameters).
439439

@@ -454,7 +454,7 @@ Applications MUST bind the message to be signed to the blinded public key. This
454454

455455
## Using prime-order groups
456456

457-
Instantiations of HDK using prime-order groups require the following cryptographic constructs:
457+
Instantiations of HDK using prime-order groups require:
458458

459459
- `G`: A prime-order group as defined in [RFC9497] with elements of type Element and scalars of type Scalar, consisting of the functions:
460460
- RandomScalar(): Outputs a random Scalar `k`.
@@ -466,6 +466,8 @@ Instantiations of HDK using prime-order groups require the following cryptograph
466466
- SerializeScalar(k): Outputs a byte string representing Scalar `k`.`
467467
- HashToScalar(msg): Outputs the result of deterministically mapping a byte string `msg` to an element in the scalar field of the prime order subgroup of `G`, using the `hash_to_field` function from a hash-to-curve suite [RFC9380].
468468

469+
Instantiations of HDK using prime-order groups provide:
470+
469471
~~~
470472
def GenerateKeyPair():
471473
sk = GenerateRandomScalar()
@@ -483,51 +485,97 @@ def DeriveBlindingFactor(bk, ctx):
483485
return bf
484486
~~~
485487

486-
Note that DeriveBlindingFactor is compatible with the definitions in [I-D.draft-irtf-cfrg-signature-key-blinding-07].
488+
Note that DeriveBlindingFactor is compatible with the definitions in [I-D.draft-irtf-cfrg-signature-key-blinding-07]. The function is almost compatible with the definitions in [I-D.draft-bradleylundberg-cfrg-arkg-02]: only in AKRG, the context string needs to be prefixed with `0x00`.
489+
490+
### Using additive blinding
491+
492+
Instantiations of HDK using additive blinding use:
487493

488-
## Using multiplicative blinding
494+
- [prime-order groups](#using-prime-order-groups)
489495

490-
Such instantations of HDK [use prime-order groups](#using-prime-order-groups) and instantiate the following:
496+
Instantiations of HDK using additive blinding provide:
491497

492498
~~~
493499
def BlindPublicKey(pk, bk, ctx):
494500
bf = DeriveBlindingFactor(bk, ctx)
495-
pk' = ScalarMult(pk, bf)
501+
pk' = Add(pk, ScalarBaseMult(bf))
496502
return pk
497503

498504
def BlindPrivateKey(sk, bf):
499-
sk' = sk * bf mod Order()
505+
sk' = sk + bf mod Order()
500506
return sk
501507

502508
def Combine(bf1, bf2):
503-
bf = bf1 * bf2 mod Order()
509+
bf = bf1 + bf2 mod Order()
504510
return bf
505511
~~~
506512

507-
## Using additive blinding
513+
Note that all algorithms in [I-D.draft-bradleylundberg-cfrg-arkg-02] use additive blinding.
514+
515+
### Using multiplicative blinding
516+
517+
Instantiations of HDK using multiplicative blinding use:
518+
519+
- [prime-order groups](#using-prime-order-groups)
508520

509-
Such instantations of HDK use [use prime-order groups](#using-prime-order-groups) and instantiate the following:
521+
Instantiations of HDK using multiplicative blinding provide:
510522

511523
~~~
512524
def BlindPublicKey(pk, bk, ctx):
513525
bf = DeriveBlindingFactor(bk, ctx)
514-
pk' = Add(pk, ScalarBaseMult(bf))
526+
pk' = ScalarMult(pk, bf)
515527
return pk
516528

517529
def BlindPrivateKey(sk, bf):
518-
sk' = sk + bf mod Order()
530+
sk' = sk * bf mod Order()
519531
return sk
520532

521533
def Combine(bf1, bf2):
522-
bf = bf1 + bf2 mod Order()
534+
bf = bf1 * bf2 mod Order()
523535
return bf
524536
~~~
525537

526-
## Using ECDH shared secrets
538+
Note that all algorithms in [I-D.draft-irtf-cfrg-signature-key-blinding-07] use multiplicative blinding.
539+
540+
## Using elliptic curves
541+
542+
Instantiations of HDK using elliptic curves use:
543+
544+
- [prime-order groups](#using-prime-order-groups)
545+
546+
Instantiations of HDK using elliptic curves require:
547+
548+
- `DST`: A domain separation tag for use with HashToScalar.
549+
- `H2C`: A hash-to-curve suite [RFC9380].
550+
551+
Instantiations of HDK using elliptic curves provide:
552+
553+
- `H`: `H` from `H2C`.
554+
- `Ns`: The output size of `H`.
555+
556+
~~~
557+
def HashToScalar(msg):
558+
scalar = hash_to_field(msg, 1) with the parameters:
559+
DST: DST
560+
F: GF(Order()), the scalar field
561+
of the prime order subgroup of EC
562+
p: Order()
563+
m: 1
564+
L: as defined in H2C
565+
expand_message: as defined in H2C
566+
return scalar
567+
~~~
568+
569+
### Using ECDH shared secrets
527570

528-
Such instantiations of HDK [use multiplicative blinding](#using-multiplicative-blinding) and require the following cryptographic construct:
571+
Instantiations of HDK using ECDH shared secrets use:
529572

530-
- `DH`: An Elliptic Curve Key Agreement Algorithm - Diffie-Hellman (ECKA-DH) [TR03111] with elliptic curve `EC`, consisting of the functions:
573+
- [elliptic curves](#using-elliptic-curves)
574+
- [multiplicative blinding](#using-multiplicative-blinding)
575+
576+
Instantiations of HDK using ECDH shared secrets provide:
577+
578+
- `DH`: The Elliptic Curve Key Agreement Algorithm - Diffie-Hellman (ECKA-DH) [TR03111] with elliptic curve `G`, consisting of the functions:
531579
- CreateSharedSecret(skX, pkY): Outputs a shared secret byte string `Z_AB` representing the x-coordinate of the Element `ScalarMult(pkY, skX)`.
532580

533581
Note that DH enables an alternative way of authenticating a key pair `(sk, pk)` without creation or verification of a signature:
@@ -570,11 +618,17 @@ Z_AB = CreateSharedSecret(sk', pkR)
570618

571619
Note that the value of `ScalarMult(pkR, bf)` does not need to be computed within the secure cryptographic device that protects `sk`.
572620

573-
## Using EC-SDSA signatures
621+
### Using EC-SDSA signatures
622+
623+
Instantiations of HDK using EC-SDSA (Schnorr) signatures use:
574624

575-
Such instantiations of HDK [use digital signatures](#using-digital-signatures) and [use additive blinding](#using-additive-blinding) and instantiate the following:
625+
- [additive blinding](#using-additive-blinding)
626+
- [digital signatures](#using-digital-signatures)
627+
- [elliptic curves](#using-elliptic-curves)
576628

577-
- `DSA`: An EC-SDSA (Schnorr) digital signature algorithm [TR03111], representing signatures as pairs `(c, s)`.
629+
Instantiations of HDK using EC-SDSA signatures provide:
630+
631+
- `DSA`: An EC-SDSA digital signature algorithm [TR03111], representing signatures as pairs `(c, s)`.
578632

579633
Note that in this case, the following definition is equivalent to the original definition of BlindSign:
580634

@@ -590,24 +644,16 @@ def BlindSign(sk, bf, msg):
590644
return signature
591645
~~~
592646

593-
## Using P-256
647+
### Using P-256
594648

595-
Such instantiations of HDK [use prime-order groups](#using-prime-order-groups) and require the following parameter:
649+
Instantiations of HDK using P-256 use:
596650

597-
- `DST`: A domain separation tag for use with HashToScalar.
651+
- [elliptic curves](#using-elliptic-curves)
652+
653+
Instantiations of HDK using P-256 provide:
598654

599-
Such instantiations instantiate the following:
600-
601-
- `Ns`: 32
602-
- `H`: SHA-256 [FIPS180-4].
603-
- `G`: The NIST curve `secp256r1` (P-256) [SEC2] with:
604-
- `HashToScalar(msg)`: Implemented by computing `hash_to_field(msg, 1)` with the parameters:
605-
- `DST`: `DST`
606-
- `F`: GF(EC-Order()), the scalar field of the prime order subgroup of `G`
607-
- `p`: EC-Order()
608-
- `m`: 1
609-
- `L`: 48
610-
- `expand_message`: `expand_message_xmd` with `H`
655+
- `G`: The NIST curve `secp256r1` (P-256) [SEC2].
656+
- `H2C`: P256_XMD:SHA-256_SSWU_RO_ [RFC9380], which uses SHA-256 [FIPS180-4] as `H`.
611657
- `KEM`: DHKEM(P-256, HKDF-SHA256) [RFC9180].
612658

613659
# Concrete HDK instantiations
@@ -616,24 +662,51 @@ The RECOMMENDED instantiation is the HDK-ECDH-P256. This avoids the risk of havi
616662

617663
## HDK-ECDH-P256
618664

619-
This instantiation [uses P-256](#using-p-256) and [uses ECDH shared secrets](#using-ecdh-shared-secrets).
665+
The HDK-ECDH-P256 instantiation of HDK uses:
666+
667+
- [P-256](#using-p-256)
668+
- [ECDH shared secrets](#using-ecdh-shared-secrets)
669+
670+
The HDK-ECDH-P256 instantiation defines:
620671

621672
- `DST`: `"ECDH Key Blind"`
622-
- `DH`: ECKA-DH with curve `EC`.
623673

624-
## HDK-ECDSA-P256
674+
## HDK-ECDSA-P256add
675+
676+
The HDK-ECDSA-P256add instantiation of HDK uses:
677+
678+
- [digital signatures](#using-digital-signatures)
679+
- [P-256](#using-p-256)
680+
- [additive blinding](#using-additive-blinding)
681+
682+
The HDK-ECDSA-P256add instantiation of HDK defines:
683+
684+
- `DST`: `"ARKG-BL-EC.ARKG-P256ADD-ECDH"` for interoperability with [I-D.draft-bradleylundberg-cfrg-arkg-02].
685+
- `DSA`: ECDSA [TR03111] with curve `G`.
686+
687+
## HDK-ECDSA-P256mul
688+
689+
The HDK-ECDSA-P256mul instantiation of HDK uses:
625690

626-
This instantiation [uses P-256](#using-p-256) and [uses digital signatures](#using-digital-signatures).
691+
- [digital signatures](#using-digital-signatures)
692+
- [P-256](#using-p-256)
693+
- [multiplicative blinding](#using-multiplicative-blinding)
627694

628-
- `DST`: `"ECDSA Key Blind"` as specified in [I-D.draft-irtf-cfrg-signature-key-blinding-07].
695+
The HDK-ECDSA-P256mul instantiation of HDK defines:
696+
697+
- `DST`: `"ECDSA Key Blind"` for interoperability with [I-D.draft-irtf-cfrg-signature-key-blinding-07].
629698
- `DSA`: ECDSA [TR03111] with curve `G`.
630699

631700
## HDK-ECSDSA-P256
632701

633-
This instantiation [uses P-256](#using-p-256) and [uses EC-SDSA signatures](#using-ec-sdsa-signatures).
702+
The HDK-ECSDSA-P256 instantiation of HDK uses:
703+
704+
- [EC-SDSA signatures](#using-ec-sdsa-signatures)
705+
- [P-256](#using-p-256)
706+
707+
The HDK-ECSDSA-P256 instantiation of HDK defines:
634708

635709
- `DST`: `"EC-SDSA Key Blind"`
636-
- `DSA`: EC-SDSA-opt (the optimised EC-SDSA) with curve `G`.
637710

638711
# Application considerations
639712

@@ -703,7 +776,7 @@ The solution proposal discussed herein works in all any WSCD architecture that s
703776
- In the case of HDK-ECDH-P256 (see [HDK-ECDH-P256](#hdk-ecdh-p256)):
704777
- P-256 ECDH key pair generation
705778
- P-256 ECDH key agreement
706-
- In the case of HDK-ECDSA-P256 (see [HDK-ECDSA-P256](#hdk-ecdsa-p256)):
779+
- In the case of HDK-ECDSA-P256mul (see [HDK-ECDSA-P256mul](#hdk-ecdsa-p256mul)):
707780
- P-256 ECDSA blinding key pair generation
708781
- P-256 ECDSA blinded signature creation
709782
- In the case of HDK-ECSDSA-P256 (see [HDK-ECSDSA-P256](#hdk-ecsdsa-p256)):

0 commit comments

Comments
 (0)