Zcash 백서

Zcash

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 35쪽 중 5쪽

se the facility to understand its use in terms of the abstraction. In this respect the abstractions play a similar rôle to that of a type system (which we also use): they add a form of redundancy to the specification that helps to express the intent. Each property is a claim that may be incorrect (or that may be insufficiently precisely stated to determine whether it is correct). An example of an incorrect security claim occurs in theZerocashprotocol [BCGGMTV2014]: the instantiation of thenote commitmentscheme used inZerocashfailed to bebindingat the intended security level (see §8.5 ‘Internal hash collision attack and fix’ on p.151). Another hazard that we should be aware of is that abstractions can be “leaky”: an instantiation may impose conditions on its correct or secure use that are not captured by the abstraction’s interface and semantics. Ideally, the abstraction would be changed to explicitly document these conditions, or the protocol changed to rely only on the original abstraction. An abstraction can also be incomplete (not quite the same thing as being leaky): it intentionally –usually for simplicity– does not model an aspect of behaviour that is important to security or correctness. An example would be resistance toside-channelattacks; this specification says little aboutside-channeldefence, among many other implementation concerns. 25 4.1 Abstract Cryptographic Schemes #abstractschemes 4.1.1 Hash Functions #abstracthashes Let MerkleDepthSprout, ℓSproutMerkle, MerkleDepthSapling, ℓSaplingMerkle , MerkleDepthOrchard, ℓOrchardMerkle , ℓSaplingivk , ℓd, ℓSeed, ℓSproutPRF , ℓhSig, and Nold be as defined in §5.3 ‘Constants’ on p.77. LetJ,J (𝑟),J (𝑟)*,𝑟 J, andℓ J be as defined in §5.4.9.3 ‘Jubjub’ on p.105. LetP* be as defined in §5.4.9.6 ‘Pallas and Vesta’ on p.108. The followinghash functionsare used in §4.9 ‘Merkle Path Validity’ on p.52: MerkleCRHSprout {0..MerkleDepth Sprout−1} ×B [ℓSproutMerkle] ×B [ℓSproutMerkle] →B [ℓSproutMerkle] MerkleCRHSapling {0..MerkleDepth Sapling−1} ×B[ℓSaplingMerkle ] ×B [ℓSaplingMerkle ] →B [ℓSaplingMerkle ] MerkleCRHOrchard {0..MerkleDepth Orchard−1}×{0.. 𝑞 P−1}×{0.. 𝑞 P−1}→{0.. 𝑞 P−1}. MerkleCRHSproutiscollision-resistantexcept on its first argument. MerkleCRHSapling and MerkleCRHOrchardarecollision- resistanton all their arguments. These functions are instantiated in §5.4.1.3 ‘Merkle Tree Hash Function’ on p.79. hSigCRH B[ℓSeed]×B [ℓSproutPRF ][Nold]×JoinSplitSig.Public→B [ℓhSig] is acollision-resistant hash functionused in §4.3 ‘JoinSplit Descriptions’ on p.41. It is instantiated in §5.4.1.4 ‘hSig Hash Function’ on p.80. EquihashGen (𝑛 N+)×N +×B Y Y[N]×N +→B [𝑛] is anotherhash function, used in §7.7.1 ‘Equihash’ on p. 139 to generate input to theEquihashsolver. The first two arguments, representing theEquihashparameters 𝑛 and 𝑘, are written subscripted. It is instantiated in §5.4.1.11 ‘Equihash Generator’ on p.88. CRHivk B[ℓJ]×B [ℓJ]→{1..2 ℓSaplingivk −1} is acollision-resistant hash functionused in §4.2.2 ‘Sapling Key Components’ on p. 38 to derive anincoming viewing keyfor a Saplingshielded payment address. It is also used in theSpend statement( §4.18.2 ‘Spend Statement (Sapling)’ on p. 64) to confirm use of the correct keys for thenotebeing spent. It is instantiated in §5.4.1.5 ‘CRHivk Hash Function’ on p.80. MixingPedersenHash J×{0.. 𝑟 J−1}→J is ahash functionused in §4.16 ‘Computingρvalues and Nullifiers’ on p. 60 to derive the unique ρ value for a Sapling-pool note. It is also used in theSpend statementto confirm use of the correct ρ value as an input tonullifierderivation. It is instantiated in §5.4.1.8 ‘Mixing Pedersen Hash Function’ on p.84. DiversifyHashSapling B[ℓd]→J (𝑟)*∪{⊥} and DiversifyHashOrchard B[ℓd]→P* arehash functionsinstantiated in §5.4.1.6 ‘DiversifyHashSapling andDiversifyHash Orchard Hash Functions’ on p. 81, satisfying the Unlinkability security property described in that section. They are used to derive adiversified basefrom adiversifier, which is specified in §4.2.2 ‘Sapling Key Components’ on p.38 and in §4.2.3 ‘Orchard Key Components’ on p.40. 4.1.2 Pseudo Random Functions #abstractprfs PRF𝑥 denotes aPseudo Random Functionkeyed by𝑥. Letℓ ask,ℓ hSig,ℓ SproutPRF ,ℓ Sproutφ ,ℓ sk,ℓ ovk,ℓ PRFexpand,ℓ PRFnfSapling,N old, andN new be as defined in §5.3 ‘Constants’ on p.77. LetSymbe as defined in §5.4.3 ‘Symmetric Encryption’ on p.91. Letℓ J andJ ⋆ (𝑟) be as defined in §5.4.9.3 ‘Jubjub’ on p.105. Letℓ P and𝑞 P be as defined in §5.4.9.6 ‘Pallas and Vesta’ on p.108. 26 For Sprout, four independent PRF𝑥 are needed: PRFaddr B[ℓask] ×B Y Y →B [ℓSproutPRF ] PRFpk B[ℓask] ×{1..N old} ×B[ℓhSig]→B [ℓSproutPRF ] PRFρ B[ℓSproutφ ]×{1..N new}×B [ℓhSig]→B [ℓSproutPRF ] PRFnfSprout B[ℓask] ×B [ℓSproutPRF ] →B [ℓSproutPRF ] These are used in §4.18.1 ‘JoinSplit Statement (Sprout)’ on p. 63; PRFaddr is also used to derive ashielded payment addressfrom aspending keyin §4.2.1 ‘Sprout Key Components’ on p.38. For Sapling, three additionalPRF 𝑥 are needed: PRFexpand B[ℓsk] ×B Y Y[N] →B Y Y[ℓPRFexpand/8] PRFockSapling BY Y[ℓovk/8]×B Y Y[ℓJ/8]×B Y Y[ℓJ/8]×B Y Y[ℓJ/8] →Sym.K PRFnfSapling J⋆(𝑟) ×B [ℓJ] →B Y Y[ℓPRFnfSapling/8] For Orchard, we needPRF expand, and also: PRFockOrchard BY Y[ℓovk/8]×B Y Y[ℓP/8]×B Y Y[ℓP/8]×B Y Y[ℓP/8]→Sym.K PRFnfOrchard F𝑞P ×F 𝑞P →F 𝑞P PRFexpand is used in the following places: • §4.2.2 ‘Sapling Key Components’ on p.38, with inputs[ 0x00],[ 0x01],[ 0x02], and[ 0x03, 𝑖 BY Y]; • [ NU5 onward] in §4.2.3 ‘Orchard Key Components’ on p. 40, with inputs [0x06], [0x07], [0x08], and with first byte 0x82; • in the processes of sending ( §4.7.2 ‘Sending Notes (Sapling)’ on p. 47 and §4.7.3 ‘Sending Notes (Orchard)’ on p. 48) and of receiving ( §4.20 ‘In-band secret distribution (Sapling and Orchard)’ on p. 70)notes, for Sapling with inputs[ 0x04]and[ 0x05], and for Orchard[𝑡]||ρ with𝑡∈{ 0x05, 0x04, 0x09}; • in [ZIP-32], with inputs [0x00], [0x01], [0x02] (intentionally matching §4.2.2 on p. 38), [0x10], [0x13], [0x14], and with first byte in{ 0x11, 0x12, 0x15, 0x16, 0x17, 0x18, 0x80, 0x81, 0x83}; •in [ZIP-316], with first byte 0xD0. PRFockSapling andPRF ockOrchard are used in §4.20 ‘In-band secret distribution (Sapling and Orchard)’ on p.70. PRFnfSapling is used in §4.18.2 ‘Spend Statement (Sapling)’ on p.64. PRFnfOrchard is used in §4.18.4 ‘Action Statement (Orchard)’ on p.66. All of thesePseudo Random Functionsare instantiated in §5.4.2 ‘Pseudo Random Functions’ on p.89. Security requirements: •Security definitions forPseudo Random Functionsare given in [BDJR2000, section 4]. • In addition to beingPseudo Random Functions, it is required that PRFaddr𝑥 , PRFρ𝑥, PRFnfSprout𝑥 , PRFnfSapling𝑥 and PRFnfOrchard𝑥 becollision-resistantacross all𝑥— i.e. finding(𝑥, 𝑦)̸= (𝑥 ′, 𝑦′)such thatPRF addr𝑥 (𝑦) =PRF addr𝑥′ (𝑦′) should not be feasible, and similarly forPRF ρ,PRF nfSprout,PRF nfSapling, andPRF nfOrchard. •See the note in §4.2.3 ‘Orchard Key Components’ on p.40 for a security caveat about the use ofPRF expand. Non-normative note: PRFnfSprout was called PRFsn inZerocash [BCGGMTV2014], and just PRFnf in some previous versions of this specification. 27 4.1.3 Pseudo Random Permutations #abstractprps PRP𝑥 denotes aPseudo Random Permutationkeyed by𝑥. Letℓ dk andℓ d be as defined in §5.3 ‘Constants’ on p.77. OnePseudo Random Permutationis used for Orchard, to generatediversifiersfrom adiversifier keyand index (an identical construction is also used for Saplingin [ZIP-32]): PRPd BY Y[ℓdk/8]×B [ℓd]→B [ℓd]. It is instantiated in §5.4.4 ‘Pseudo Random Permutations’ on p.91. Security requirement:PRP d is a keyedPseudo Random Permutationas defined in [BKR2001]. 4.1.4 Symmetric Encryption #abstractsym Let Sym be anauthenticated one-time symmetric encryption schemewith keyspace Sym.K, encrypting plaintexts inSym.Pto produce ciphertexts inSym.C. Sym.Encrypt Sym.K×Sym.P→Sym.Cis the encryption algorithm. Sym.Decrypt Sym.K×Sym.C→Sym.P∪{⊥} is the decryption algorithm, such that for any K∈Sym.K and P∈Sym.P,Sym.Decrypt K(Sym.EncryptK(P)) =P.⊥is used to represent the decryption of an invalid ciphertext. Security requirement: Sym must beone-time(INT-CTXT ∧ IND-CPA)-secure [BN2007]. “One-time” here means that an honest protocol participant will almost surely encrypt only one message with a given key; however, the adversary may make many adaptive chosen ciphertext queries for a given key. 4.1.5 Key Agreement #abstractkeyagreement Akey agreement schemeis a cryptographic protocol in which two parties agree a shared secret, each using their private keyand the other party’spublic key. Akey agreement scheme KA defines a type ofpublic keys KA.Public, a type ofprivate keys KA.Private, and a type of shared secretsKA.SharedSecret. Optionally, it also defines a typeKA.PublicPrimeOrder⊆KA.Public. Optional: Let KA.FormatPrivate B[ℓSproutPRF ]→KA.Private be a function to convert a bit string of length ℓSproutPRF to a KA private key. Let KA.DerivePublic KA.Private×KA.Public→KA.Public be a function that derives theKA public keycorresponding to a givenKAprivate keyand base point. LetKA.Agree KA.Private×KA.Public→KA.SharedSecretbe the agreement function. Optional: LetKA.Base KA.Publicbe a public base point. Note:The range ofKA.DerivePublicmay be a strict subset ofKA.Public. Security requirements: •KA.FormatPrivatemust preserve sufficient entropy from its input to be used as a secureKAprivate key. • The key agreement and the KDF defined in the next section must together satisfy a suitable adaptive security assumption along the lines of [Bernstein2006, section 3] or [ABR1999, Definition 3]. More precise formalization of these requirements is beyond the scope of this specification. 28 4.1.6 Key Derivation #abstractkdf AKey Derivation Functionis defined for a particularkey agreement schemeandauthenticated one-time symmetric encryption scheme; it takes the shared secret produced by the key agreement and additional arguments, and derives a key suitable for the encryption scheme. The inputs to theKey Derivation Functiondiffer between the Sproutand Saplingand OrchardKDFs: KDFSprout takes as input an output index in{1..Nnew}, the value hSig, the shared Diffie–Hellman secret sharedSecret, theephemeral public key epk, and the recipient’s publictransmission key pkenc. It is suitable for use with KASprout and derives keys forSym.Encrypt. KDFSprout {1..Nnew}×B [ℓhSig]×KA Sprout.SharedSecret×KA Sprout.Public×KA Sprout.Public→Sym.K KDFSapling takes as input the shared Diffie–Hellman secret sharedSecret and theephemeral public key epk. (It does not have inputs taking the place of the output index, hSig, or pkenc.) It is suitable for use with KASapling and derives keys forSym.Encrypt. KDFSapling KASapling.SharedSecret×B Y Y[ℓJ/8]→Sym.K As in Sapling, KDFOrchard takes as input the shared Diffie–Hellman secret sharedSecret and theephemeral public key epk. It is suitable for use withKA Orchard and derives keys forSym.Encrypt. KDFOrchard KAOrchard.SharedSecret×B Y Y[ℓP/8]→Sym.K Security requirements: • The asymmetric encryption scheme in §4.19 ‘In-band secret distribution (Sprout)’ on p. 68, constructed from KASprout,KDF Sprout andSym, is required to be IND-CCA2-secure andkey-private. • The asymmetric encryption scheme in §4.20 ‘In-band secret distribution (Sapling and Orchard)’ on p. 70, constructed from KASapling, KDFSapling and Sym or from KAOrchard, KDFOrchard and Sym, is required to be IND- CCA2-secure andkey-private. Key privacyis defined in [BBDP2001]. 4.1.7 Signature #abstractsig Asignature schemeSigdefines: •a type ofsigning keysSig.Private; •a type ofvalidating keysSig.Public; •a type of messagesSig.Message; •a type of signaturesSig.Signature; •a randomizedsigning keygeneration algorithmSig.GenPrivate ()→R Sig.Private; •an injectivevalidating keyderivation algorithmSig.DerivePublic Sig.Private→Sig.Public; •a randomized signing algorithmSig.Sign Sig.Private×Sig.Message→R Sig.Signature; •a validating algorithmSig.Validate Sig.Public×Sig.Message×Sig.Signature→B; such that for anysigning key sk←R Sig.GenPrivate() and correspondingvalidating key vk=Sig.DerivePublic(sk) , and any𝑚 Sig.Messageand𝑠 Sig.Signature←R Sig.Signsk(𝑚),Sig.Validate vk(𝑚, 𝑠) = 1. 29 Zcashuses foursignature schemes: • one used for signatures that can be validated by script operations such asOP_CHECKSIG and OP_CHECKMULTISIG as inBitcoin; • one called JoinSplitSig which is used to signtransactionsthat contain at least oneJoinSplit description (instantiated in §5.4.6 ‘Ed25519’ on p.93); • [ Sapling onward] one called SpendAuthSig which is used to sign authorizations ofSpend transfers(instantiated in §5.4.7.1 ‘Spend Authorization Signature (Sapling and Orchard)’ on p.98); • [ Sapling onward] one called BindingSig. ASapling binding signatureis used to enforce balance ofSpend transfersandOutput transfers, and to prevent their replay acrosstransactions. Similarly, anOrchard binding signatureis used to enforce balance ofAction transfersand to prevent their replay. BindingSig is instantiated for both Saplingand Orchardin §5.4.7.2 ‘Binding Signature (Sapling and Orchard)’ on p.98. The signature scheme used in script operations is instantiated byECDSAon thesecp256k1 curve. JoinSplitSig is instantiated byEd25519. SpendAuthSig and BindingSig are instantiated by RedDSA; on theJubjub curvein Sapling, and on thePallas curvein Orchard. The following security property is needed forJoinSplitSig and BindingSig. Security requirements forSpendAuthSig are defined in the next section, §4.1.7.1 ‘Signature with Re-Randomizable Keys’ on p. 31. An additional requirement forBindingSigis defined in §4.1.7.2 ‘Signature with Signing Key to Validating Key Monomorphism’ on p.32. Security requirement: JoinSplitSig and each instantiation of BindingSig must be Strongly Unforgeable under (non-adaptive) Chosen Message Attack (SU-CMA), as defined for example in[BDEHR2011, Definition 6].7 This allows an adversary to obtain signatures on chosen messages, and then requires it to be infeasible for the adversary to forge a previously unseen valid (message, signature) pair without access to thesigning key. Non-normative notes: • We need separatesigning keygeneration andvalidating keyderivation algorithms, rather than the more conventional combined key pair generation algorithmSig.Gen ()→R Sig.Private×Sig.Public , to support the key derivation in §4.2.2 ‘Sapling Key Components’ on p. 38 and in §4.2.3 ‘Orchard Key Components’ on p. 40. The definitions of schemes with additional features in §4.1.7.1 ‘Signature with Re-Randomizable Keys’ on p. 31 and in §4.1.7.2 ‘Signature with Signing Key to Validating Key Monomorphism’ on p. 32 also become simpler. • A fresh signature key pair is generated for eachtransactioncontaining aJoinSplit description. Since each key pair is only used for one signature (see §4.11 ‘Non-malleability (Sprout)’ on p. 54), aone-time signature schemewould suffice for JoinSplitSig. This is also the reason why only security against non-adaptive chosen message attack is needed. In fact the instantiation of JoinSplitSig uses a scheme designed for security under adaptive attack even when multiple signatures are signed under the same key. • [ Sapling onward] The same remarks as above apply to BindingSig, except that the key is derived from the randomness ofvalue commitments. This results in the same distribution as of freshly generated key pairs, for eachtransactioncontainingSpend descriptionsorOutput descriptionsorAction descriptions. • SU-CMA security requires it to be infeasible for the adversary, not knowing theprivate key, to forge a distinct signature on a previously seen message. That is,JoinSplit signaturesandSapling binding signaturesand Orchard binding signaturesare intended to benonmalleablein the sense of [BIP-62]. •The terminology used in this specification is that we “validate” signatures, and “verify”zk-SNARK proofs. 7 The scheme defined in that paper was attacked in [LM2017], but this has no impact on the applicability of the definition. 30 4.1.7.1 Signature with Re-Randomizable Keys #abstractsigrerand Asignature scheme with re-randomizable keysSigis asignature schemethat additionally defines: •a type ofrandomizersSig.Random; •arandomizergeneratorSig.GenRandom ()→R Sig.Random; •asigning keyrandomization algorithmSig.RandomizePrivate Sig.Random×Sig.Private→Sig.Private; •avalidating keyrandomization algorithmSig.RandomizePublic Sig.Random×Sig.Public→Sig.Public; •a distinguished “identity”randomizer𝒪 Sig.Random Sig.Random such that: •for any𝛼 Sig.Random,Sig.RandomizePrivate 𝛼 Sig.Private→Sig.Privateis injective and easily invertible; •Sig.RandomizePrivate 𝒪Sig.Random is the identity function onSig.Private. •for anysk Sig.Private, Sig.RandomizePrivate(𝛼,sk) :𝛼← R Sig.GenRandom() is identically distributed toSig.GenPrivate(). •for anysk Sig.Privateand𝛼 Sig.Random, Sig.RandomizePublic(𝛼,Sig.DerivePublic(sk)) =Sig.DerivePublic(Sig.RandomizePrivate(𝛼,sk)). The following security requirement for suchsignature schemesis based on that given in [FKMSSS2016, section 3]. Note that we require Strong Unforgeability withRe-randomizedKeys, not Existential Unforgeability withRe- randomizedKeys (the latter is called “Unforgeability underRe-randomizedKeys” in [FKMSSS2016, Definition 8]). Unlike the case for JoinSplitSig, we require security under adaptive chosen message attack with multiple messages signed using a given key. (Although eachnoteuses a differentre-randomizedkey pair, the same original key pair can bere-randomizedfor multiplenotes, and also it can happen that multipletransactionsspending the same noteare revealed to an adversary.) Security requirement: Strong Unforgeability with Re-randomized Keys under adaptive Chosen Message Attack (SURK-CMA) For anysk Sig.Private, let Osk Sig.Message×Sig.Random→Sig.Signature be a signing oracle with state 𝑄 P (︀ Sig.Message×Sig.Signature )︀ initialized to{} that records queried messages and corresponding signatures. Osk :=let mutable𝑄←{}in(𝑚 Sig.Message, 𝛼 Sig.Random)↦→ let𝜎=Sig.Sign Sig.RandomizePrivate(𝛼,sk)(𝑚) set𝑄←𝑄∪{(𝑚, 𝜎)} return𝜎 Sig.Signature. For random sk←R Sig.GenPrivate() and vk=Sig.DerivePublic(sk) , it must be infeasible for an adversary given vk and a new instance of Osk to find (𝑚′, 𝜎′, 𝛼′) such that Sig.ValidateSig.RandomizePublic(𝛼′,vk)(𝑚′, 𝜎′) = 1 and (𝑚′, 𝜎′)̸∈O sk.𝑄. 31 Non-normative notes: • Therandomizerand key arguments to Sig.RandomizePrivate and Sig.RandomizePublic are swapped relative to [FKMSSS2016, section 3]. • The requirement for the identityrandomizer𝒪Sig.Random simplifies the definition of SURK-CMA by removing the need for two oracles (because the oracle for original keys, called O1 in [FKMSSS2016], is a special case of the oracle for randomized keys). • Since Sig.RandomizePrivate(𝛼,sk) :𝛼← R Sig.Random has an identical distribution to Sig.GenPrivate(), and since Sig.DerivePublic is a deterministic function, the combination of are-randomized validating keyand signature(s) under that key do not reveal the key from which it wasre-randomized. • Since Sig.RandomizePrivate𝛼 is injective and easily invertible, knowledge of Sig.RandomizePrivate(𝛼,sk) and 𝛼 implies knowledge ofsk. 4.1.7.2 Signature with Signing Key to Validating Key Monomorphism #abstractsigmono Asignature scheme with key monomorphismSigis asignature schemethat additionally defines: •an abelian group onsigning keys, with operation Sig.Private×Sig.Private→Sig.Privateand identity𝒪 ; •an abelian group onvalidating keys, with operation Sig.Public×Sig.Public→Sig.Publicand identity𝒪 . such that for anysk 1..2 Sig.Private,Sig.DerivePublic(sk 1 sk2) =Sig.DerivePublic(sk 1) Sig.DerivePublic(sk2). In other words, Sig.DerivePublic is amonomorphism(that is, an injective homomorphism) from thesigning key group to thevalidating keygroup. ForN N+, • N 𝑖=1 sk𝑖 meanssk 1 sk2 ··· skN; • N 𝑖=1 vk𝑖 meansvk 1 vk2 ··· vkN. WhenN = 0these yield the appropriate group identity, i.e. 0 𝑖=1 sk𝑖 =𝒪 and 0 𝑖=1 vk𝑖 =𝒪 . skmeans thesigning keysuch that( sk) sk=𝒪 , andsk 1 sk2
프로젝트로 돌아가기