⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 draft-ietf-dnsext-ecc-key-07.txt

📁 bind 源码 最新实现 linux/unix/windows平台
💻 TXT
📖 第 1 页 / 共 3 页
字号:
   the order defined by the picture.   Of the remaining parameters, PFHKQABCGY are variable length.  When   present, each is preceded by a one-octet length field as shown in the   diagram above.  The length field does not include itself.  The length   field may have values from 0 through 110.  The parameter length in   octets is determined by a conditional formula: If LL<=64, the   parameter length is LL.  If LL>64, the parameter length is 16 times   (LL-60).  In some cases, a parameter value of 0 is sensible, and MAY   be represented by an LL value of 0, with the data field omitted.  A   length value of 0 represents a parameter value of 0, not an absent   parameter.  (The data portion occupies 0 space.)  There is no   requirement that a parameter be represented in the minimum number of   octets; high-order 0 octets are allowed at the front end.  Parameters   are always right adjusted, in a field of length defined by LL.  The   octet-order is always most-significant first, least-significant last.   The parameters H and K may have an optional sign bit stored in the   unused high-order bit of their length fields.   LP defines the length of the prime P.  P must be an odd prime.  The   parameters LP,P are present if and only if the flag M=1.  If M=0, the   prime is 2.   LF,F define an explicit field polynomial.  This parameter pair is   present only when FMT = 1.  The length of a polynomial coefficient is   ceiling(log2 P) bits.  Coefficients are in the numerical range   [0,P-1].  The coefficients are packed into fixed-width fields, from   higher order to lower order.  All coefficients must be present,   including any 0s and also the leading coefficient (which is required   to be 1).  The coefficients are right justified into the octet string   of length specified by LF, with the low-order "constant" coefficient   at the right end.  As a concession to storage efficiency, the higher   order bits of the leading coefficient may be elided, discarding high-   order 0 octets and reducing LF.  The degree is calculated byR. Schroeppel, et al                                            [Page 6]INTERNET-DRAFT                                       ECC Keys in the DNS   determining the bit position of the left most 1-bit in the F data   (counting the right most bit as position 0), and dividing by   ceiling(log2 P).  The division must be exact, with no remainder.  In   this format, all of the other degree and field parameters are   omitted.  The next parameters will be LQ,Q.   If FMT>=2, the degree of the field extension is specified explicitly,   usually along with other parameters to define the field polynomial.   DEG is a two octet field that defines the degree of the field   extension.  The finite field will have P^DEG elements.  DEG is   present when FMT>=2.   When FMT=2, the field polynomial is specified implicitly.  No other   parameters are required to define the field; the next parameters   present will be the LQ,Q pair.  The implicit field poynomial is the   lexicographically smallest irreducible (mod P) polynomial of the   correct degree.  The ordering of polynomials is by highest-degree   coefficients first -- the leading coefficient 1 is most important,   and the constant term is least important.  Coefficients are ordered   by sign-magnitude: 0 < 1 < -1 < 2 < -2 < ...  The first polynomial of   degree D is X^D (which is not irreducible).  The next is X^D+1, which   is sometimes irreducible, followed by X^D-1, which isn't.  Assuming   odd P, this series continues to X^D - (P-1)/2, and then goes to X^D +   X, X^D + X + 1, X^D + X - 1, etc.   When FMT=3, the field polynomial is a binomial, X^DEG + K.  P must be   odd.  The polynomial is determined by the degree and the low order   term K.  Of all the field parameters, only the LK,K parameters are   present.  The high-order bit of the LK octet stores on optional sign   for K; if the sign bit is present, the field polynomial is X^DEG - K.   When FMT=4, the field polynomial is a trinomial, X^DEG + H*X^DEGH +   K.  When P=2, the H and K parameters are implicitly 1, and are   omitted from the representation.  Only DEG and DEGH are present; the   next parameters are LQ,Q.  When P>2, then LH,H and LK,K are   specified.  Either or both of LH, LK may contain a sign bit for its   parameter.   When FMT=5, then P=2 (only).  The field polynomial is the exact   quotient of a trinomial divided by a small polynomial, the trinomial   divisor.  The small polynomial is right-adjusted in the two octet   field TRDV.  DEG specifies the degree of the field.  The degree of   TRDV is calculated from the position of the high-order 1 bit.  The   trinomial to be divided is X^(DEG+degree(TRDV)) + X^DEGH + 1.  If   DEGH is 0, the middle term is omitted from the trinomial.  The   quotient must be exact, with no remainder.   When FMT=6, then P=2 (only).  The field polynomial is a pentanomial,   with the degrees of the middle terms given by the three 2-octetR. Schroeppel, et al                                            [Page 7]INTERNET-DRAFT                                       ECC Keys in the DNS   values DEGH, DEGI, DEGJ.  The polynomial is X^DEG + X^DEGH + X^DEGI +   X^DEGJ + 1.  The values must satisfy the inequality DEG > DEGH > DEGI   > DEGJ > 0.        DEGH, DEGI, DEGJ  are two-octet fields that define the degree of           a term in a field polynomial.   DEGH is present when FMT = 4,           5, or 6.  DEGI and DEGJ are present only when FMT = 6.        TRDV is a two-octet right-adjusted binary polynomial of degree <           16.  It is present only for FMT=5.        LH and H define the H parameter, present only when FMT=4 and P           is odd.  The high bit of LH is an optional sign bit for H.        LK and K define the K parameter, present when FMT = 3 or 4, and           P is odd.  The high bit of LK is an optional sign bit for K.   The remaining parameters are concerned with the elliptic curve and   the signature algorithm.        LQ defines the length of the prime Q.  Q is a prime > 2^159.   In all 5 of the parameter pairs LA+A,LB+B,LC+C,LG+G,LY+Y, the data   member of the pair is an element from the finite field defined   earlier.  The length field defines a long octet string.  Field   elements are represented as (mod P) polynomials of degree < DEG, with   DEG or fewer coefficients.  The coefficients are stored from left to   right, higher degree to lower, with the constant term last.  The   coefficients are represented as integers in the range [0,P-1].  Each   coefficient is allocated an area of ceiling(log2 P) bits.  The field   representation is right-justified; the "constant term" of the field   element ends at the right most bit.  The coefficients are fitted   adjacently without regard for octet boundaries.  (Example: if P=5,   three bits are used for each coefficient.  If the field is GF[5^75],   then 225 bits are required for the coefficients, and as many as 29   octets may be needed in the data area.  Fewer octets may be used if   some high-order coefficients are 0.)  If a flag requires a field   element to be negated, each non-zero coefficient K is replaced with   P-K.  To save space, 0 bits may be removed from the left end of the   element representation, and the length field reduced appropriately.   This would normally only happen with A,B,C, because the designer   chose curve parameters with some high-order 0 coefficients or bits.   If the finite field is simply (mod P), then the field elements are   simply numbers (mod P), in the usual right-justified notation.  If   the finite field is GF[2^D], the field elements are the usual right-   justified polynomial basis representation.R. Schroeppel, et al                                            [Page 8]INTERNET-DRAFT                                       ECC Keys in the DNS        LA,A is the first parameter of the elliptic curve equation.           When P>=5, the flag A = 1 indicates A should be negated (mod           P).  When P=2 (indicated by the flag M=0), the flag A = 1           indicates that the parameter pair LA,A is replaced by the two           octet parameter ALTA.  In this case, the parameter A in the           curve equation is x^ALTA, where x is the field generator.           Parameter A often has the value 0, which may be indicated by           LA=0 (with no A data field), and sometimes A is 1, which may           be represented with LA=1 and a data field of 1, or by setting           the A flag and using an ALTA value of 0.        LB,B is the second parameter of the elliptic curve equation.           When P>=5, the flag B = 1 indicates B should be negated (mod           P).  When P=2 or 3, the flag B selects an alternate curve           equation.        LC,C is the third parameter of the elliptic curve equation,           present only when P=2 (indicated by flag M=0) and flag B=1.        LG,G defines a point on the curve, of order Q.  The W-coordinate           of the curve point is given explicitly; the Z-coordinate is           implicit.        LY,Y is the user's public signing key, another curve point of           order Q.  The W-coordinate is given explicitly; the Z-           coordinate is implicit.  The LY,Y parameter pair is always           present.3. The Elliptic Curve Equation   (The coordinates of an elliptic curve point are named W,Z instead of   the more usual X,Y to avoid confusion with the Y parameter of the   signing key.)   The elliptic curve equation is determined by the flag octet, together   with information about the prime P.  The primes 2 and 3 are special;   all other primes are treated identically.   If M=1, the (mod P) or GF[P^D] case, the curve equation is Z^2 = W^3   + A*W + B.  Z,W,A,B are all numbers (mod P) or elements of GF[P^D].   If A and/or B is negative (i.e., in the range from P/2 to P), and   P>=5, space may be saved by putting the sign bit(s) in the A and B   bits of the flags octet, and the magnitude(s) in the parameter   fields.   If M=1 and P=3, the B flag has a different meaning: it specifies an   alternate curve equation, Z^2 = W^3 + A*W^2 + B.  The middle term of   the right-hand-side is different.  When P=3, this equation is moreR. Schroeppel, et al                                            [Page 9]INTERNET-DRAFT                                       ECC Keys in the DNS   commonly used.   If M=0, the GF[2^N] case, the curve equation is Z^2 + W*Z = W^3 +   A*W^2 + B.  Z,W,A,B are all elements of the field GF[2^N].  The A   parameter can often be 0 or 1, or be chosen as a single-1-bit value.   The flag B is used to select an alternate curve equation, Z^2 + C*Z =   W^3 + A*W + B.  This is the only time that the C parameter is used.4. How do I Compute Q, G, and Y?   The number of points on the curve is the number of solutions to the   curve equation, + 1 (for the "point at infinity").  The prime Q must   divide the number of points.  Usually the curve is chosen first, then   the number of points is determined with Schoof's algorithm.  This   number is factored, and if it has a large prime divisor, that number   is taken as Q.   G must be a point of order Q on the curve, satisfying the equation        Q * G  =  the point at infinity (on the elliptic curve)   G may be chosen by selecting a random [RFC 1750] curve point, and   multiplying it by (number-of-points-on-curve/Q).  G must not itself   be the "point at infinity"; in this astronomically unlikely event, a   new random curve point is recalculated.   G is specified by giving its W-coordinate.  The Z-coordinate is   calculated from the curve equation.  In general, there will be two   possible Z values.  The rule is to choose the "positive" value.   In the (mod P) case, the two possible Z values sum to P.  The smaller   value is less than P/2; it is used in subsequent calculations.  In   GF[P^D] fields, the highest-degree non-zero coefficient of the field   element Z is used; it is chosen to be less than P/2.   In the GF[2^N] case, the two possible Z values xor to W (or to the   parameter C with the alternate curve equation).  The numerically   smaller Z value (the one which does not contain the highest-order 1   bit of W (or C)) is used in subsequent calculations.   Y is specified by giving the W-coordinate of the user's public   signature key.  The Z-coordinate value is determined from the curve   equation.  As with G, there are two possible Z values; the same rule   is followed for choosing which Z to use.R. Schroeppel, et al                                           [Page 10]INTERNET-DRAFT                                       ECC Keys in the DNS   During the key generation process, a random [RFC 1750] number X must   be generated such that 1 <= X <= Q-1.  X is the private key and is   used in the final step of public key generation where Y is computed   as        Y = X * G (as points on the elliptic curve)   If the Z-coordinate of the computed point Y is wrong (i.e., Z > P/2   in the (mod P) case, or the high-order non-zero coefficient of Z >   P/2 in the GF[P^D] case, or Z sharing a high bit with W(C) in the   GF[2^N] case), then X must be replaced with Q-X.  This will   correspond to the correct Z-coordinate.5. Elliptic Curve SIG Resource Records   The signature portion of an RR RDATA area when using the EC   algorithm, for example in the RRSIG and SIG [RFC records] RRs is   shown below.                       1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |                   R, (length determined from LQ)           .../   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |                   S, (length determined from LQ)           .../   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   R and S are integers (mod Q).  Their length is specified by the LQ   field of the corresponding KEY RR and can also be calculated from the   SIG RR's RDLENGTH. They are right justified, high-order-octet first.   The same conditional formula for calculating the length from LQ is   used as for all the other length fields above.   The data signed is determined as specified in [RFC 2535].  Then the

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -