[go: up one dir, main page]

CN100589375C - A Mapping Method of ID and Key - Google Patents

A Mapping Method of ID and Key Download PDF

Info

Publication number
CN100589375C
CN100589375C CN200610115440A CN200610115440A CN100589375C CN 100589375 C CN100589375 C CN 100589375C CN 200610115440 A CN200610115440 A CN 200610115440A CN 200610115440 A CN200610115440 A CN 200610115440A CN 100589375 C CN100589375 C CN 100589375C
Authority
CN
China
Prior art keywords
key
key factor
fixed
identifier
factor matrix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN200610115440A
Other languages
Chinese (zh)
Other versions
CN1909445A (en
Inventor
李春强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN200610115440A priority Critical patent/CN100589375C/en
Publication of CN1909445A publication Critical patent/CN1909445A/en
Application granted granted Critical
Publication of CN100589375C publication Critical patent/CN100589375C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Storage Device Security (AREA)

Abstract

本发明提供了一种标识和密钥的映射方法,该方法应用于基于标识的组合密钥管理系统中,在所述系统中已经生成密钥因子矩阵,该方法包括:根据定长二进制标识或由非定长二进制标识转换的定长二进制标识的长度值检验密钥因子矩阵的大小;根据所述定长二进制标识计算出密钥因子在密钥因子矩阵中相应的行标组和列标组,以定位密钥因子;利用所述行标组和列标组对应的密钥因子计算与所述定长二进制标识对应的密钥。本发明简化了标识到密钥的映射方法,本发明的映射方法简洁高效,易于实现,而且对于像IPv4、IPv6这类的标识可以实现标识到密钥的无冲突映射。

Figure 200610115440

The present invention provides a method for mapping IDs and keys. The method is applied to an ID-based combined key management system. In the system, a key factor matrix has been generated. The method includes: according to the fixed-length binary ID or The length value of the fixed-length binary identifier converted from the non-fixed-length binary identifier checks the size of the key factor matrix; calculates the corresponding row and column group of the key factor in the key factor matrix according to the fixed-length binary identifier , to locate the key factor; use the key factor corresponding to the row label group and the column label group to calculate the key corresponding to the fixed-length binary identifier. The invention simplifies the mapping method from the identification to the key. The mapping method of the invention is simple, efficient and easy to implement, and can realize the non-conflict mapping from the identification to the key for identifications such as IPv4 and IPv6.

Figure 200610115440

Description

一种标识和密钥的映射方法 A Mapping Method of ID and Key

技术领域 technical field

本发明涉及组合密钥管理技术领域,尤其涉及基于标识的组合密钥管理技术领域,具体来讲是一种标识和密钥的映射方法。The present invention relates to the technical field of combination key management, in particular to the technical field of identification-based combination key management, and specifically relates to a method for mapping an identification and a key.

背景技术 Background technique

现代密码学的安全是建立在密钥保密而不是算法保密的基础上的,因此密钥的管理保护成了信息保密的关键。密钥和密钥拥有者标识之间的绑定是现代网络安全研究的最重要内容之一。目前将密钥和密钥拥有者标识绑定有两种方式,一种是通过密钥来生成密钥拥有者的标识,CGA(Cryptographically Generated Address)是这种方式的典型代表;另一种方式是通过标识来确定出该标识对应的密钥,即基于标识的密码体制。1984年,Shamir提出了基于标识的签名设想,2001年Don Boneh和Matthew Franklin根据Shamir的设想,提出了以Weil配对方式实现的基于标识的密钥管理体制。组合公钥(CPK)密码体制也是一种基于标识的密钥管理体制,它可以根据通信对方的标识直接计算出对方的公钥,在CPK体制中实现标识到密钥的映射是一个关键问题。在一般的公钥体制中,各用户的公钥是直接公布的,有多少用户,就公布多少个公钥,而在组合公钥技术中,各用户的公钥不直接公布,而只公布公钥因子矩阵,各用户的公钥则通过公钥因子矩阵和相关标识计算出来。The security of modern cryptography is based on key secrecy rather than algorithm secrecy, so key management and protection has become the key to information secrecy. The binding between the key and the key owner's identity is one of the most important contents of modern network security research. At present, there are two ways to bind the key and the key owner's identity. One is to generate the key owner's identity through the key. CGA (Cryptographically Generated Address) is a typical representative of this method; the other way The key corresponding to the identity is determined through the identity, that is, the identity-based cryptosystem. In 1984, Shamir proposed an identity-based signature idea. In 2001, Don Boneh and Matthew Franklin proposed an identity-based key management system based on Weil pairing based on Shamir's idea. The combined public key (CPK) cryptosystem is also an identity-based key management system, which can directly calculate the other party's public key according to the identity of the communicating party. In the CPK system, it is a key issue to realize the mapping from the identity to the key. In the general public key system, the public key of each user is directly published, and as many public keys as there are users, but in the combined public key technology, the public key of each user is not directly published, but only the public key is published. The key factor matrix, and the public key of each user is calculated through the public key factor matrix and related identifiers.

在基于标识的组合密钥管理体制中,文献([1]南湘浩,陈钟;网络安全技术概论;北京,国防工业出版社,2003.7;[2]唐文,南相浩,陈钟;基于椭圆曲线密钥系统的组合公钥技术;计算机工程与应用,2003年21期)给出的由标识到密钥的映射算法如下所述:In the identity-based combined key management system, literature ([1] Nan Xianghao, Chen Zhong; Introduction to Network Security Technology; Beijing, National Defense Industry Press, 2003.7; [2] Tang Wen, Nan Xianghao, Chen Zhong; The combined public key technology based on the elliptic curve key system; Computer Engineering and Application, 2003, No. 21) gives the mapping algorithm from the identifier to the key as follows:

首先是计算行标:The first is to calculate the row index:

给定行密钥RowKey,它是系统中一个公开的常量。首先通过一种HASH函数(比如MD5、SHA-1等),将不定长度的标识ID变换成一个固定长度的变量Data1。Given a row key RowKey, it is a public constant in the system. First, through a HASH function (such as MD5, SHA-1, etc.), the variable-length identification ID is transformed into a fixed-length variable Data1.

即,HASH(ID)=Data1;That is, HASH(ID)=Data1;

然后,通过加密算法(如AES)将中间变量Data1作为数据,用行密钥RowKey加密后得到MAP0;将MAP0作为数据,再用密钥RowKey加密得出MAP1;类似的直到得出所需的MAP值为止。为了便于说明,设密钥因子矩阵的大小为32×32。则Then, the intermediate variable Data1 is used as data by an encryption algorithm (such as AES), and MAP 0 is obtained after being encrypted with the row key RowKey; MAP 0 is used as data, and MAP 1 is obtained after being encrypted with the key RowKey; similarly until the obtained up to the required MAP value. For the sake of illustration, the size of the key factor matrix is assumed to be 32×32. but

AESRowKey(Data1)=MAP0AES RowKey (Data1) = MAP 0 ;

AESRowKey(MAP0)=MAP1AES RowKey (MAP0)= MAP1 ;

接着,MAP0的16个字节分别用M(本例中M=32)模,得出16个小于M的行标,以MAP[0]~MAP[15]表示,MAP1的16个字节分别模M后得出16个小于M的行标,以MAP[16]~MAP[31]表示;Then, the 16 bytes of MAP 0 are respectively molded by M (M=32 in this example), and 16 row labels smaller than M are obtained, represented by MAP[0]~MAP[15]. The 16 bytes of MAP 1 After modulo M of each section, 16 line labels smaller than M are obtained, represented by MAP[16]~MAP[31];

MAP0[i]mod M=MAP[i](i=0,1...,15);MAP 0 [i] mod M = MAP [i] (i = 0, 1..., 15);

MAP1[i]mod M=MAP[i](i=16,17...,31);MAP 1 [i] mod M = MAP [i] (i = 16, 17..., 31);

至此得出了32个行标,用于行的32次选择。So far, 32 row labels have been obtained, which are used for 32 selections of rows.

在行标计算后,进行列标的计算:After calculating the row labels, calculate the column labels:

为了避免列标的顺序取用,设置列变量的置换算法PMT,其结果是(0,1,2,...,31)的全排列的一种,计算方法如下所示。In order to avoid the sequential use of the column labels, the replacement algorithm PMT of the column variables is set, and the result is a full arrangement of (0, 1, 2, ..., 31). The calculation method is as follows.

首先计算PMT算法所用的密钥PMT_KEY;First calculate the key PMT_KEY used by the PMT algorithm;

AESColKey(ID)=PMT_KEY,ColKey是系统中一个公开的常量。AES ColKey (ID) = PMT_KEY, ColKey is a public constant in the system.

用PMTPMT_KEY(原序)=PERMUT;原序是0,1,......31的自然序。PERMUT是新的置换。Use PMT PMT_KEY (original sequence)=PERMUT; the original sequence is the natural sequence of 0, 1, ... 31. PERMUT is the new permutation.

上述的方法是针对各种类型的标识做出的一种通用的映射方法,该方法计算量大,计算复杂,而且可能存在映射冲突问题。现有方案中,没有针对象IPv4、IPv6地址这类具有一定特殊性的标识给出一个特定的映射算法,而在实际的场景中,这一类的标识有着非常广泛的应用。The above-mentioned method is a general mapping method for various types of identifiers, which is computationally intensive and complex, and may have mapping conflicts. In the existing solutions, there is no specific mapping algorithm for specific identifiers such as IPv4 and IPv6 addresses, but in actual scenarios, such identifiers are widely used.

发明内容 Contents of the invention

鉴于现有技术中的上述问题,本发明提供了一种标识和密钥的映射方法,简化了标识到密钥的映射计算,映射方法简洁高效,而且对于具有特殊性的标识可以实现标识到密钥的无冲突映射。In view of the above-mentioned problems in the prior art, the present invention provides a method for mapping IDs and keys, which simplifies the calculation of mapping from IDs to keys. Conflict-free mapping of keys.

本发明提供了一种标识和密钥的映射方法应用于基于标识的组合密钥管理系统中,在所述系统中已经生成密钥因子矩阵,所述方法包括步骤:步骤1,根据定长二进制标识或由非定长二进制标识转换的定长二进制标识的长度值检验密钥因子矩阵的大小,所述密钥因子矩阵的大小表示为M×2n;其中,包括:对定长二进制标识的长度值进行因子分解按照公式进行,该公式的表达式为:S=M×r+k;其中,S:定长二进制标识的长度值;M:密钥因子矩阵的行数;2n:密钥因子矩阵的列数;k≥0且k<M;S、M、k、r、n均为整数;根据因子分解的结果判断密钥因子矩阵的大小是否合适;若判断结果为合适,则执行步骤2;步骤2,根据所述定长二进制标识计算出密钥因子在密钥因子矩阵中相应的行标组和列标组;其中,包括:计算与所述定长二进制标识相应的列标组;对密钥因子矩阵的所有行标进行置换,得到与所述定长二进制标识相应的行标组;步骤3,利用所述行标组和列标组对应的密钥因子计算与所述定长二进制标识对应的密钥。所述步骤1还包括:若判断结果为不合适,则重新生成密钥因子矩阵。The present invention provides a mapping method of ID and key applied in ID-based combined key management system, in which the key factor matrix has been generated, and the method includes the following steps: step 1, according to the fixed-length binary The length value of the fixed-length binary identifier converted from the identifier or the non-fixed-length binary identifier checks the size of the key factor matrix, and the size of the key factor matrix is expressed as M×2 n ; wherein, it includes: the fixed-length binary identifier The factorization of the length value is carried out according to the formula, and the expression of the formula is: S=M×r+k; among them, S: the length value of the fixed-length binary identifier; M: the row number of the key factor matrix; 2 n : the encryption The number of columns of the key factor matrix; k≥0 and k<M; S, M, k, r, and n are all integers; judge whether the size of the key factor matrix is appropriate according to the result of factorization; if the judgment result is appropriate, then Execute step 2; step 2, calculate the key factor corresponding row group and column group in the key factor matrix according to the fixed-length binary identification; wherein, including: calculating the column corresponding to the fixed-length binary identification All the row labels of the key factor matrix are replaced to obtain the row label group corresponding to the fixed-length binary identifier; step 3, using the key factor calculation corresponding to the row label group and the column label group The key corresponding to the fixed-length binary identifier. The step 1 also includes: if the judgment result is inappropriate, regenerating the key factor matrix.

判断密钥因子矩阵的大小是否合适是指:判断r是否大于n;若判断结果为r≤n<S,则该密钥因子矩阵的大小合适;若判断结果为r>n,则所述密钥因子矩阵的大小不合适;其中,S:定长二进制标识的长度值;n、r均为整数。Judging whether the size of the key factor matrix is appropriate refers to: judging whether r is greater than n; if the judgment result is r≤n<S, then the size of the key factor matrix is appropriate; if the judgment result is r>n, the encryption The size of the key factor matrix is inappropriate; among them, S: the length value of the fixed-length binary identifier; n and r are both integers.

所述计算与定长二进制标识相应的列标组,包括:判断k<n-r是否成立;The calculation of the column label group corresponding to the fixed-length binary identifier includes: judging whether k<n-r is established;

如果判断结果为是,则按照公式计算列标组Ci(ID),该公式的表达式为:Ci(ID)=[ID>>(i×r)]&(2n-1),i=0…M-1;其中,>>表示循环移位运算,ID为所述定长二进制标识;If the judgment result is yes, calculate the column index group C i (ID) according to the formula, the expression of the formula is: C i (ID)=[ID>>(i×r)]&(2 n -1), i=0...M-1; Among them, >> means circular shift operation, and ID is the fixed-length binary identifier;

如果判断结果为否,则按照公式计算列标组Ci(ID),该公式表达式为:If the judgment result is no, calculate the column index group C i (ID) according to the formula, and the formula expression is:

Ci(ID)=[ID>>(i×r)]&(2n-1),i=0...M-[k-(n-r)]-1,和C i (ID)=[ID>>(i×r)]&(2 n -1), i=0...M-[k-(nr)]-1, and

Ci(ID)={ID>>[i×(r+1)]}&(2n-1),i=M-[k-(n-r)]…M-1;C i (ID)={ID>>[i×(r+1)]}&(2 n -1), i=M-[k-(nr)]...M-1;

其中,>>表示循环移位运算,ID为所述定长二进制标识;M、k、n、r、i为整数。Wherein, >> represents a circular shift operation, ID is the fixed-length binary identifier; M, k, n, r, i are integers.

所述计算与定长二进制标识相应的列标组,包括:按照公式计算列标组Ci(ID),该公式表达式为:Ci(ID)={ID>>[i×(r+1)]}&(2n-1),i=0...M-1;其中,>>表示循环移位运算;ID为定长二进制标识;n、r、i为整数。The calculation of the column label group corresponding to the fixed-length binary identifier includes: calculating the column label group C i (ID) according to the formula, and the formula expression is: C i (ID)={ID>>[i×(r+ 1)]}&(2 n -1), i=0...M-1; wherein, >> represents a circular shift operation; ID is a fixed-length binary identifier; n, r, and i are integers.

所述计算与定长二进制标识相应的列标组,包括:按照公式计算列标组Ci(ID),该公式表达式为:Ci(ID)=[ID>>(i×r’)]&(2n-1),i=0...M-1;The calculation of the column label group corresponding to the fixed-length binary identifier includes: calculating the column label group C i (ID) according to the formula, and the formula expression is: C i (ID)=[ID>>(i×r') ]&( 2n -1), i=0...M-1;

其中,>>表示循环移位运算,S>r’>r,r’不是S的因子,ID为定长二进制标识;S为定长二进制标识的长度值;r、r’、n、i为整数。Among them, >> means circular shift operation, S>r'>r, r' is not a factor of S, ID is a fixed-length binary identifier; S is the length value of a fixed-length binary identifier; r, r', n, i are integer.

所述对密钥因子矩阵的所有行标进行置换,包括:直接选取数据序列作为行标组,该数据序列为:0,1,......,M-1,其中,M为密钥因子矩阵的行数。The replacement of all the row labels of the key factor matrix includes: directly selecting a data sequence as a row label group, and the data sequence is: 0, 1, ..., M-1, where M is a password The number of rows of the key factor matrix.

所述对密钥因子矩阵的所有行标进行置换,包括:将数据序列顺序存放、逆序存放或以随机的顺序存放在数组R[i]中,该数据序列为:0,1,......,M-1;其中i=0,1,......,M-1;M为密钥因子矩阵的行数。The replacement of all the row labels of the key factor matrix includes: storing the data sequence in sequence, in reverse order, or in random order in the array R[i], the data sequence is: 0, 1, ... ..., M-1; where i=0, 1, ..., M-1; M is the number of rows of the key factor matrix.

所述对密钥因子矩阵的所有行标进行置换,还包括步骤:The replacement of all row labels of the key factor matrix also includes the steps of:

步骤11,设置i=0;Step 11, set i=0;

步骤12,判断ID mod(M-i)<M-i-1是否成立;Step 12, judging whether ID mod(M-i)<M-i-1 is established;

步骤13,如果步骤12的判断结果为是,则将R[ID mod(M-i)]和R[M-i-1]交换位置;如果步骤12的判断结果为否,则执行步骤14;Step 13, if the judgment result of step 12 is yes, then R[ID mod (M-i)] and R[M-i-1] exchange position; If the judgment result of step 12 is no, then execute step 14;

步骤14,设置i=i+1,判断i是否等于M-2;Step 14, setting i=i+1, judging whether i is equal to M-2;

步骤15,如果步骤14的判断结果为否,则重复步骤12至步骤15;如果步骤14的判断结果为是,则置换结束,且经上述步骤处理后的数组R[i]存放的是(0…M-1)的一个置换。Step 15, if the judgment result of step 14 is no, then repeat step 12 to step 15; if the judgment result of step 14 is yes, then the replacement ends, and the array R[i] after the above-mentioned steps is stored is (0 ... a permutation of M-1).

所述对密钥因子矩阵的所有行标进行置换,还包括步骤:The replacement of all row labels of the key factor matrix also includes the steps of:

步骤21,设置i=0;Step 21, set i=0;

步骤22,判断ID mod(M-i)≠0是否成立;Step 22, judging whether ID mod(M-i)≠0 is established;

步骤23,如果步骤22的判断结果为是,则将R[(ID mod(M-i))+i]和R[i]交换位置;如果步骤22的判断结果为否,则执行步骤24;Step 23, if the judgment result of step 22 is yes, then R[(ID mod (M-i))+i] and R[i] exchange position; If the judgment result of step 22 is no, then execute step 24;

步骤24,设置i=i+1,判断i是否等于M-2;Step 24, setting i=i+1, judging whether i is equal to M-2;

步骤25,如果步骤24的判断结果为否,则重复步骤22至步骤25;如果步骤24的判断结果为是,则置换结束,且经上述步骤处理后的数组R[i]存放的是(0...M-1)的一个置换。Step 25, if the judgment result of step 24 is no, then repeat step 22 to step 25; if the judgment result of step 24 is yes, then the replacement ends, and the array R[i] after the above-mentioned steps is stored is (0 ... a permutation of M-1).

本发明还提供了一种标识和密钥的映射方法,应用于基于标识的组合密钥管理系统中,在所述系统中已经生成密钥因子矩阵,所述方法包括步骤:步骤1,根据定长二进制标识或由非定长二进制标识转换的定长二进制标识的长度值检验密钥因子矩阵的大小,所述密钥因子矩阵的大小表示为2m×N;其中,包括:对定长二进制标识的长度值进行因子分解按照公式进行,该公式的表达式为:S=N×r+k;其中,S:定长二进制标识的长度值;2m:密钥因子矩阵的行数;N:密钥因子矩阵的列数;k≥0且k<N;S、N、k、r、m为整数;根据因子分解的结果判断密钥因子矩阵的大小是否合适;若判断结果为合适,则执行步骤2;步骤2,根据所述定长二进制标识计算出密钥因子在密钥因子矩阵中相应的行标组和列标组;其中,包括:计算与所述定长二进制标识相应的行标组;对密钥因子矩阵的所有列标进行置换,得到与所述定长二进制标识相应的列标组;步骤3,利用所述行标组和列标组对应的密钥因子计算与所述定长二进制标识对应的密钥。The present invention also provides a method for mapping IDs and keys, which is applied to an ID-based combined key management system. In the system, a key factor matrix has been generated. The method includes steps: Step 1, according to the defined The length value of the long binary identifier or the fixed-length binary identifier converted from the non-fixed-length binary identifier checks the size of the key factor matrix, and the size of the key factor matrix is expressed as 2 m × N; wherein, it includes: The factorization of the length value of the identification is carried out according to the formula, and the expression of the formula is: S=N×r+k; among them, S: the length value of the fixed-length binary identification; 2 m : the number of rows of the key factor matrix; N : The number of columns of the key factor matrix; k≥0 and k<N; S, N, k, r, m are integers; judge whether the size of the key factor matrix is appropriate according to the result of factorization; if the judgment result is appropriate, Then perform step 2; step 2, calculate the key factor in the key factor matrix corresponding row label group and column label group according to described fixed-length binary identification; Wherein, comprise: calculate and described fixed-length binary identification corresponding row mark group; all column marks of the key factor matrix are replaced to obtain the column mark group corresponding to the fixed-length binary identifier; step 3, using the key factor calculation and The key corresponding to the fixed-length binary identifier.

所述步骤1还包括:若判断结果为不合适,则重新生成密钥因子矩阵。The step 1 also includes: if the judgment result is inappropriate, regenerating the key factor matrix.

判断密钥因子矩阵的大小是否合适是指:判断r是否大于m;若判断结果为r≤m<S,则该密钥因子矩阵的大小合适;若判断结果为r>m,则所述密钥因子矩阵的大小不合适;其中,S:定长二进制标识的长度值;m、r为整数。Judging whether the size of the key factor matrix is appropriate refers to: judging whether r is greater than m; if the judgment result is r≤m<S, then the size of the key factor matrix is appropriate; if the judgment result is r>m, then the encryption The size of the key factor matrix is inappropriate; among them, S: the length value of the fixed-length binary identifier; m and r are integers.

所述计算与定长二进制标识相应的行标组,包括:判断k<m-r是否成立;The calculation of the row label group corresponding to the fixed-length binary identifier includes: judging whether k<m-r holds true;

若判断结果为是,则按照公式计算行标组Ci(ID),该公式的表达式为:Ci(ID)=[ID>>(i×r)]&(2m-1),i=0…N-1;If the judgment result is yes, then calculate the line label group C i (ID) according to the formula, the expression of the formula is: C i (ID)=[ID>>(i×r)]&(2 m -1), i=0...N-1;

若判断结果为否,则按照公式计算行标组Ci(ID),该公式表达式为:If the judgment result is no, calculate the line label group C i (ID) according to the formula, and the formula expression is:

Ci(ID)=[ID>>(i×r)]&(2m-1),i=0…N-[k-(m-r)]-1,和C i (ID)=[ID>>(i×r)]&(2 m -1), i=0...N-[k-(mr)]-1, and

Ci(ID)={ID>>[i×(r+1)]}&(2m-1),i=N-[k-(m-r)]…N-1;C i (ID)={ID>>[i×(r+1)]}&(2 m -1), i=N-[k-(mr)]...N-1;

其中,>>表示循环移位运算,ID为所述的定长二进制标识;N、k、r、m、i为整数。Wherein, >> represents a circular shift operation, and ID is the fixed-length binary identifier; N, k, r, m, and i are integers.

所述计算与定长二进制标识相应的行标组,包括:按照公式计算行标组Ci(ID),该公式表达式为:Ci(ID)={ID>>[i×(r+1)]}&(2m-1),i=0...N-1;其中,>>表示循环移位运算,ID为所述的定长二进制标识;N、r、m、i为整数。The calculation of the line label group corresponding to the fixed-length binary identifier includes: calculating the line label group C i (ID) according to the formula, and the formula expression is: C i (ID)={ID>>[i×(r+ 1)]}&(2 m -1), i=0...N-1; Among them, >> means circular shift operation, ID is the fixed-length binary identifier; N, r, m, i are integer.

所述计算与定长二进制标识相应的行标组,包括:按照公式计算行标组Ci(ID),该公式表达式为:Ci(ID)=[ID>>(i×r’)]&(2m-1),i=0...N-1;其中,>>表示循环移位运算,S>r’>r,r’不是S的因子,ID为所述的定长二进制标识;r’、r、m、i为整数。The calculation of the line label group corresponding to the fixed-length binary identifier includes: calculating the line label group C i (ID) according to the formula, and the formula expression is: C i (ID)=[ID>>(i×r') ]&(2 m -1), i=0...N-1; Among them, >> means cyclic shift operation, S>r'>r, r' is not a factor of S, ID is the fixed length Binary identifier; r', r, m, i are integers.

所述对密钥因子矩阵的所有列标进行置换,包括:直接选取数据序列作为列标组,该数据序列为:0,1,......,N-1,其中,N为密钥因子矩阵的列数。The replacement of all column labels of the key factor matrix includes: directly selecting a data sequence as a column label group, and the data sequence is: 0, 1, ..., N-1, where N is a password The number of columns of the key factor matrix.

所述对密钥因子矩阵的所有列标进行置换,包括:将数据序列顺序存放、逆序存放或以随机的顺序存放在数组R[i]中,该数据序列为:0,1,......,N-1;其中i=0,1,......,N-1;N为密钥因子矩阵的列数。The replacement of all column labels of the key factor matrix includes: storing the data sequence in sequence, in reverse order, or in random order in the array R[i], the data sequence is: 0, 1, ... ..., N-1; where i=0, 1, ..., N-1; N is the number of columns of the key factor matrix.

所述对密钥因子矩阵的所有列标进行置换,还包括步骤:The replacement of all column labels of the key factor matrix also includes the steps of:

步骤31,设置i=0;Step 31, setting i=0;

步骤32,判断ID mod(N-i)<N-i-1是否成立;Step 32, judging whether ID mod(N-i)<N-i-1 is established;

步骤33,如果步骤32的判断结果为是,则将R[ID mod(N-i)]和R[N-i-1]交换位置;如果步骤32的判断结果为否,则执行步骤34;Step 33, if the judgment result of step 32 is yes, then R[ID mod (N-i)] and R[N-i-1] exchange position; If the judgment result of step 32 is no, then execute step 34;

步骤34,设置i=i+1,判断i是否等于N-2;Step 34, setting i=i+1, judging whether i is equal to N-2;

步骤35,如果步骤34的判断结果为否,则重复步骤32至步骤35;如果步骤34的判断结果为是,则置换结束,且经上述步骤处理后的数组R[i]存放的是(0…M-1)的一个置换。Step 35, if the judgment result of step 34 is no, then repeat step 32 to step 35; If the judgment result of step 34 is yes, then the replacement ends, and the array R[i] after the above-mentioned steps is stored is (0 ... a permutation of M-1).

所述对密钥因子矩阵的所有列标进行置换,还包括步骤:The replacement of all column labels of the key factor matrix also includes the steps of:

步骤41,设置i=0;Step 41, setting i=0;

步骤42,判断ID mod(N-i)≠0是否成立;Step 42, judging whether ID mod(N-i)≠0 is established;

步骤43,如果步骤42的判断结果为是,则将R[(ID mod(N-i))+i]和R[i]交换位置;如果步骤42的判断结果为否,则执行步骤44;Step 43, if the judgment result of step 42 is yes, then R[(ID mod (N-i))+i] and R[i] exchange position; If the judgment result of step 42 is no, then execute step 44;

步骤44,设置i=i+1,判断i是否等于N-2;Step 44, setting i=i+1, judging whether i is equal to N-2;

步骤45,如果步骤44的判断结果为否,则重复步骤42至步骤45;如果步骤44的判断结果为是,则置换结束,且经上述步骤处理后的数组R[i]存放的是(0…M-1)的一个置换。Step 45, if the judgment result of step 44 is no, then repeat step 42 to step 45; If the judgment result of step 44 is yes, then the replacement ends, and the array R[i] after the above-mentioned steps is stored is (0 ... a permutation of M-1).

所述的步骤3包括:从密钥因子矩阵中选取与所述的行标组和列标组对应的密钥因子;利用所述密钥因子计算与所述定长二进制标识对应的密钥。The step 3 includes: selecting the key factor corresponding to the row label group and the column label group from the key factor matrix; using the key factor to calculate the key corresponding to the fixed-length binary identifier.

在离散对数密码系统中,利用密钥因子按照公式计算密钥;其中,按照公式计算私钥SKID;按照公式

Figure C20061011544000152
计算公钥PKID;其中,p和g为离散对数密码系统的参数,p是素数,g是有限域Fp生成元,g小于p,Ri为行标,Ci为列标,S[Ri,Ci]为与标识对应的私钥因子。In the discrete logarithm cryptosystem, the key is calculated according to the formula using the key factor; where, according to the formula Calculate the private key SK ID ; according to the formula
Figure C20061011544000152
Calculate the public key PK ID ; Wherein, p and g are the parameters of the discrete logarithm cryptosystem, p is a prime number, g is a finite field Fp generator, g is less than p, R i is a row mark, C i is a column mark, S[ R i , C i ] are private key factors corresponding to the identity.

在椭圆曲线密码系统中,利用密钥因子按照公式计算密钥;其中,按照公式

Figure C20061011544000153
计算私钥SKID;按照公式SKID=SKID×G计算公钥PKID;其中,n和G为椭圆曲线密码系统的参数,G是椭圆曲线E(Fp)上的基点,n是素数,n是基点G的阶,Ri为行标,Ci为列标,S[Ri,Ci]为与标识对应的私钥因子。In the elliptic curve cryptosystem, the key is calculated according to the formula using the key factor; where, according to the formula
Figure C20061011544000153
Calculate the private key SK ID ; Calculate the public key PK ID according to the formula SK ID =SK ID ×G; Wherein, n and G are the parameters of the elliptic curve cryptosystem, and G is the base point on the elliptic curve E (Fp), and n is a prime number, n is the order of the base point G, R i is the row label, C i is the column label, and S[R i , C i ] is the private key factor corresponding to the identity.

采用哈希函数或消息鉴别码函数将所述非定长二进制标识转换为定长二进制标识。The non-fixed-length binary identifier is converted into a fixed-length binary identifier by using a hash function or a message authentication code function.

本发明的有益效果在于,简化了标识到密钥的映射计算,映射算法简洁高效,而且对于具有特殊性的标识可以实现标识到密钥的无冲突映射。The beneficial effect of the invention is that the mapping calculation from the identifier to the key is simplified, the mapping algorithm is simple and efficient, and the non-conflict mapping from the identifier to the key can be realized for the identifier with particularity.

附图说明 Description of drawings

图1A和图1B分别为本发明的公钥因子矩阵和私钥因子矩阵的示意图;Fig. 1A and Fig. 1 B are the schematic diagrams of public key factor matrix and private key factor matrix of the present invention respectively;

图2为本发明一实施例的方法流程图;Fig. 2 is a method flowchart of an embodiment of the present invention;

图3为本发明一实施例的方法流程图;Fig. 3 is a method flowchart of an embodiment of the present invention;

图4为本发明一实施例的方法流程图;Fig. 4 is a method flowchart of an embodiment of the present invention;

图5为本发明另一实施例的方法流程图。Fig. 5 is a flowchart of a method according to another embodiment of the present invention.

具体实施方式 Detailed ways

以下结合附图详细说明本发明。The present invention will be described in detail below in conjunction with the accompanying drawings.

本发明提供了一种标识和密钥的映射方法,应用于基于标识的组合密钥管理系统中,在所述系统中已经生成密钥因子矩阵,所述的方法包括:根据定长二进制标识或由非定长二进制标识转换的定长二进制标识的长度值检验密钥因子矩阵的大小;根据所述定长二进制标识计算出密钥因子在密钥因子矩阵中相应的行标组和列标组,以定位密钥因子;利用所述行标组和列标组对应的密钥因子计算与所述定长二进制标识对应的密钥。The present invention provides a method for mapping IDs and keys, which is applied to an ID-based combined key management system. In the system, a key factor matrix has been generated. The method includes: according to the fixed-length binary ID or The length value of the fixed-length binary identifier converted from the non-fixed-length binary identifier checks the size of the key factor matrix; calculates the corresponding row and column group of the key factor in the key factor matrix according to the fixed-length binary identifier , to locate the key factor; use the key factor corresponding to the row label group and the column label group to calculate the key corresponding to the fixed-length binary identifier.

其中,所述的标识可以是像IPv4、IPv6地址这类具有一定特殊性的标识,对于像IPv4、IPv6地址这类标识,其特殊性在于,标识本身即为S比特(bit)的二进制标识;对于原始标识是一个由字母、数字等混合元素组成的标识,可以先通过哈希(HASH)或加密算法处理生成一个定长的二进制标识后再进行相应的映射计算,其中,将变长标识变换为定长值的方法可以采用消息鉴别码(MAC:Message Authentication Code)函数或普通的HASH算法。Wherein, described mark can be the mark that has certain particularity like IPv4, IPv6 address this class, for such mark as IPv4, IPv6 address, its particularity is that mark itself is the binary mark of S bit (bit); For the original logo which is composed of letters, numbers and other mixed elements, a fixed-length binary logo can be generated through hash (HASH) or encryption algorithm first, and then the corresponding mapping calculation can be carried out. Among them, the variable-length logo is transformed into The method for a fixed-length value can use a message authentication code (MAC: Message Authentication Code) function or a common HASH algorithm.

总之,对于任意一种标识,均能通过本发明提供的标识和密钥的映射方法实现密钥和密钥拥有者标识之间的绑定。In a word, for any kind of identification, the binding between the key and the key owner's identification can be realized through the identification and key mapping method provided by the present invention.

在本发明的实施例中,密钥因子矩阵包括公钥因子矩阵和私钥因子矩阵,密钥包括公钥和私钥,密钥因子包括公钥因子和私钥因子。而且,在实施本发明的映射方法时,系统中已生成了大小为M×N的密钥因子矩阵,其中N=2n,M=2m。公、私钥因子矩阵是基于标识的组合密钥管理体制的基础。私钥是在私钥因子矩阵中按照一定的映射规则在每行(或列)各选取一个私钥因子通过相应运算计算出;相应的,公钥是在公钥因子矩阵中按照一定的映射规则在每行(或列)各选取一个公钥因子通过相应运算计算出。设私钥因子矩阵为SKM=[Sij],其中i=0...M-1,j=0...N-1;如果私钥是从私钥因子矩阵中每行各选取一个私钥因子计算出,则对N做限定,要求N=2n,n为正整数;如果私钥是从私钥因子矩阵中每列各选取一个私钥因子计算出,则对M进行限定,要求M=2m,m为正整数。In an embodiment of the present invention, the key factor matrix includes a public key factor matrix and a private key factor matrix, the key includes a public key and a private key, and the key factor includes a public key factor and a private key factor. Moreover, when implementing the mapping method of the present invention, a key factor matrix with a size of M×N has been generated in the system, where N=2 n , M=2 m . The factor matrix of public and private keys is the basis of the identity-based combined key management system. The private key is calculated by selecting a private key factor in each row (or column) according to a certain mapping rule in the private key factor matrix through corresponding operations; correspondingly, the public key is calculated in the public key factor matrix according to a certain mapping rule Select a public key factor in each row (or column) and calculate it through corresponding operations. Let the private key factor matrix be SKM=[S ij ], where i=0...M-1, j=0...N-1; if a private key is selected from each row of the private key factor matrix If the key factor is calculated, N is limited, and N=2 n is required, and n is a positive integer; if the private key is calculated by selecting a private key factor from each column in the private key factor matrix, then M is limited, requiring M=2 m , m is a positive integer.

公私钥因子无论是按行选取还是按列选取其计算都是类似的。其区别仅在于:Whether the public-private key factor is selected by row or by column, its calculation is similar. The only difference is:

如果是按行选取,则先计算列标组;再对所有的行标进行置换,即所得到的行标是所有行标的全排列的一种;If it is selected by row, first calculate the column label group; then replace all the row labels, that is, the obtained row label is a kind of full arrangement of all row labels;

如果是按列选取,则先计算行标组;再对所有的列标进行置换,即所得到的列标组是所有列标的全排列的一种。If it is selected by column, first calculate the row label group; then replace all the column labels, that is, the obtained column label group is a kind of full arrangement of all column labels.

下面结合附图对本发明进行详细说明。The present invention will be described in detail below in conjunction with the accompanying drawings.

实施例一Embodiment one

在本实施例中,以公私钥因子是按行选取为例进行介绍。In this embodiment, the public-private key factor is selected by row as an example for introduction.

如图1A和图1B所示分别为私钥因子矩阵和公钥因子矩阵示意图。如图所示,私钥因子矩阵为SKM=[Sij],其中i=0...M-1,j=0...N-1;相应的公钥因子矩阵为PKM=[Pij],其中i=0...M-1,j=0...N-1。FIG. 1A and FIG. 1B are schematic diagrams of a private key factor matrix and a public key factor matrix, respectively. As shown in the figure, the private key factor matrix is SKM=[S ij ], where i=0...M-1, j=0...N-1; the corresponding public key factor matrix is PKM=[P ij ], where i=0...M-1, j=0...N-1.

在椭圆曲线密码系统中,设G是某椭圆曲线的基点,则Pij=Sij×G,即PKM=SKM×G。In the elliptic curve cryptosystem, suppose G is the base point of an elliptic curve, then P ij =S ij ×G, that is, PKM=SKM×G.

在离散对数密码系统中,T={g,p},其中p是素数,g是有限域Fp生成元,g小于p,则

Figure C20061011544000171
In the discrete logarithm cryptosystem, T={g, p}, where p is a prime number, g is a finite field Fp generator, and g is less than p, then
Figure C20061011544000171

通常密钥因子矩阵的大小关系到系统的安全性,同时也和系统的规模(即用户数)是相关的,而标识的长度决定了系统中最大的用户数。Usually, the size of the key factor matrix is related to the security of the system, and is also related to the scale of the system (that is, the number of users), and the length of the identification determines the maximum number of users in the system.

下面,结合图2至图4说明本实施例,在图2至图4的流程图中,在实施本发明的映射方法之前,系统中已经生成了大小为M×N的密钥因子矩阵,其中N=2n,M=2m。将本发明的映射方法分为三个过程:密钥因子矩阵的检验过程、行标组和列标组的计算过程和密钥的计算过程。Below, this embodiment will be described in conjunction with FIGS. 2 to 4. In the flowcharts of FIGS. N=2 n , M=2 m . The mapping method of the present invention is divided into three processes: the verification process of the key factor matrix, the calculation process of the row label group and the column label group, and the calculation process of the key.

需要说明的是,因为对于像IPv4、IPv6地址这类具有S bit的定长二进制标识和包含有由字母、数字等混合元素组成的标识,本发明的映射方法都可以应用。It should be noted that the mapping method of the present invention can be applied to fixed-length binary identifiers with S bits like IPv4 and IPv6 addresses and identifiers that are composed of mixed elements such as letters and numbers.

因此,对于使用类似于DNS域名的通用标识的系统,如图2所示,在进行密钥因子矩阵的检验之前,需要将通用标识转换为定长二进制标识,并将其直接作为以下过程中使用的定长二进制标识(见步骤S101)。Therefore, for a system that uses a general identifier similar to a DNS domain name, as shown in Figure 2, before the key factor matrix is checked, the general identifier needs to be converted into a fixed-length binary identifier and used directly as the following process fixed-length binary identifier (see step S101).

对于标识为S bit的定长二进制标识,如图4所示,可将其直接作为以下过程中使用的定长二进制标识(见步骤S301)。For being marked as the fixed-length binary sign of S bit, as shown in Figure 4, it can be directly used as the fixed-length binary sign (seeing step S301) used in the following process.

另外,如图3所示,还可以选取上述定长二进制标识的一部分作为以下过程中使用的定长二进制标识(见步骤S201)。例如:如果密钥生成中心所管理的范围是IPv6的一个子网,其子网前缀是n bit,那么系统在取标识时可以只考虑128-n bit的接口标识部分来决定密钥因子矩阵的大小以及标识和密钥间的映射。同理,对于一个使用类似于DNS域名的通用标识的系统,在将通用标识转换为定长标识时,可以根据系统的规模而只取经过哈希(HASH)函数或消息鉴别码(MAC:Message Authentication Code)函数计算得出的值的一部分进行映射计算即可。In addition, as shown in FIG. 3 , a part of the fixed-length binary identifier may also be selected as the fixed-length binary identifier used in the following process (see step S201 ). For example: if the scope managed by the key generation center is a subnet of IPv6, and its subnet prefix is n bits, then the system can only consider the 128-n bit interface identification part to determine the key factor matrix Size and mapping between IDs and keys. Similarly, for a system that uses a general identifier similar to a DNS domain name, when converting the general identifier into a fixed-length identifier, only the hash (HASH) function or the message authentication code (MAC: Message) may be used according to the scale of the system. Authentication Code) function to calculate a part of the value of the mapping calculation.

一、密钥因子矩阵的检验过程1. The verification process of the key factor matrix

密钥因子矩阵的检验过程为根据定长二进制标识或由非定长二进制标识转换的定长二进制标识的长度值检验密钥因子矩阵的大小。The verification process of the key factor matrix is to verify the size of the key factor matrix according to the length value of the fixed-length binary identifier or the fixed-length binary identifier converted from the non-fixed-length binary identifier.

检验密钥因子矩阵的大小包括:Checking the size of the key factor matrix involves:

对定长二进制标识的长度值进行因子分解;根据因子分解的结果判断密钥因子矩阵的大小是否合适;如果所述的判断步骤的结果为是,则进行行标组和列标组的计算过程。如果所述的判断步骤的结果为否,则重新生成密钥因子矩阵。Carry out factorization to the length value of fixed-length binary identification; Judging whether the size of key factor matrix is suitable according to the result of factorization; If the result of described judging step is yes, then carry out the calculation process of row label group and column label group . If the result of the judging step is no, regenerate the key factor matrix.

如图2、图3和图4所示,对密钥因子矩阵的检验过程具体如下:As shown in Figure 2, Figure 3 and Figure 4, the verification process of the key factor matrix is as follows:

将定长二进制标识的长度值按照S=M×r+k进行因子分解,其中k≥0且k<M(见步骤S102);如果r≤n<S,则密钥因子矩阵可用(见步骤S103);如果r>n,则所述密钥因子矩阵太小,需要重新生成密钥因子矩阵(见步骤S109),其中M为密钥因子矩阵的行数,S为定长二进制标识的长度值,k为0或正整数,r、n为正整数。The length value of the fixed-length binary identifier is factorized according to S=M×r+k, wherein k≥0 and k<M (see step S102); if r≤n<S, then the key factor matrix is available (see step S103); if r>n, then the key factor matrix is too small, and the key factor matrix needs to be regenerated (see step S109), wherein M is the number of rows of the key factor matrix, and S is the length of the fixed-length binary identifier value, k is 0 or a positive integer, r and n are positive integers.

举一个特例进行说明:将系统中的定长的S bit的二进制标识表示为:S=M×r(此时取k=0),依然假定公私钥是在公私钥因子矩阵中按照一定的映射规则在每行各选取一个公私钥因子通过相应运算计算出,则密钥因子矩阵的大小可以取M×2n’,n’≥n。例如在以IPv6地址为标识的系统中,IPv6地址是128bit,128=32×4,则密钥因子矩阵的大小可以取为32×24Give a special example to illustrate: the fixed-length S bit binary identifier in the system is expressed as: S=M×r (take k=0 at this time), and it is still assumed that the public and private keys are in the public and private key factor matrix according to a certain mapping The rule selects a public-private key factor in each row and calculates it through corresponding operations, then the size of the key factor matrix can be M×2 n ', n'≥n. For example, in a system identified by an IPv6 address, the IPv6 address is 128 bits, 128=32×4, and the size of the key factor matrix can be taken as 32×2 4 .

二、行标组和列标组的计算过程2. Calculation process of row mark group and column mark group

为了计算一个标识对应的公私钥,需要找出计算公私钥的密钥因子,要定位密钥因子,则需要根据标识计算出密钥因子在密钥因子矩阵中相应的行标组和列标组。In order to calculate the public-private key corresponding to an identifier, it is necessary to find out the key factor for calculating the public-private key. To locate the key factor, it is necessary to calculate the corresponding row and column group of the key factor in the key factor matrix according to the identifier. .

首先,进行列标组的计算。First, calculate the column label group.

在上述的密钥因子矩阵的检验过程中,已经将定长二进制标识ID的长度值按照S=M×r+k进行因子分解,其中k≥0且k<M,M为密钥因子矩阵的行数,S为定长二进制标识的长度值。因为已经经过了上述密钥因子矩阵的检验过程,因此,该公式中的r≤n<S。In the process of checking the above-mentioned key factor matrix, the length value of the fixed-length binary identification ID has been factorized according to S=M×r+k, where k≥0 and k<M, and M is the key factor matrix The number of lines, S is the length value of the fixed-length binary identifier. Because the verification process of the above-mentioned key factor matrix has been passed, r≤n<S in this formula.

下面提供了三种方法通过所述定长二进制标识ID来计算列标组的方法。The following provides three methods for calculating the column label group through the fixed-length binary ID.

第一种方法the first method

如图2所示,计算过程如下:As shown in Figure 2, the calculation process is as follows:

如果k<n-r,则计算列标组Ci(ID)=[ID>>(i×r)]&(2n-1),i=0...M-1;其中,>>表示循环移位运算(见步骤S104、S105);If k<nr, then calculate the index group C i (ID)=[ID>>(i×r)]&(2 n -1), i=0...M-1; where, >> means cycle Shift operation (see steps S104, S105);

如果k≥n-r,则按照下述公式计算列标组Ci(ID)(见步骤S110):If k≥nr, calculate the index group C i (ID) according to the following formula (see step S110):

Ci(ID)=[ID>>(i×r)]&(2n-1),i=0...M-[k-(n-r)]-1,C i (ID)=[ID>>(i×r)]&(2 n -1), i=0...M-[k-(nr)]-1,

Ci(ID)={ID>>[i×(r+1)]}&(2n-1),i=M-[k-(n-r)]...M-1C i (ID)={ID>>[i×(r+1)]}&(2 n -1), i=M-[k-(nr)]...M-1

其中,>>表示循环移位运算。Among them, >> represents a circular shift operation.

第二种方法The second method

如图3所示,按下述公式计算列标组Ci(ID)(见步骤S205):As shown in FIG. 3, the column label group C i (ID) is calculated according to the following formula (see step S205):

Ci(ID)={ID>>[i×(r+1)]}&(2n-1),i=0...M-1C i (ID)={ID>>[i×(r+1)]}&(2 n -1), i=0...M-1

其中,>>表示循环移位运算。Among them, >> represents a circular shift operation.

第三种方法third method

如图4所示,按下述公式计算列标组Ci(ID)(见步骤S305):As shown in Figure 4, the column label group C i (ID) is calculated according to the following formula (see step S305):

Ci(ID)=[ID>>(i×r’)]&(2n-1),i=0...M-1C i (ID)=[ID>>(i×r')]&(2 n -1), i=0...M-1

其中,>>表示循环移位运算,S>r’>r,要求r’不是的S因子。Among them, >> represents the cyclic shift operation, S>r'>r, and requires that r' is not an S factor.

其次,进行行标组的计算。Second, calculate the row label group.

密钥因子从密钥因子矩阵的每一行选取一个,因此行标组是(0...M-1)的一个置换,如图2所示,最简单的方式就是直接选取0...M-1(见步骤S106)。The key factor is selected from each row of the key factor matrix, so the row label group is a permutation of (0...M-1), as shown in Figure 2, the easiest way is to directly select 0...M -1 (see step S106).

此外,还可以通过下述两种方法进行行标置换:In addition, the following two methods can also be used to replace row labels:

第一种方法the first method

如图3所示,见步骤S206~S212,把0...M-1顺序放在数组R[0]...R[M-1]。然后执行下面的运算步骤:As shown in Figure 3, see steps S206-S212, put 0...M-1 in the array R[0]...R[M-1]. Then perform the following calculation steps:

1)设置i=0;1) set i=0;

2)判断ID mod(M-i)<M-i-1是否成立;2) Determine whether ID mod(M-i)<M-i-1 is established;

3)如果2)的结果为是,则将R[ID mod(M-i)]和R[M-i-1]交换位置;如果2)的结果为否,则执行4);3) If the result of 2) is yes, then R[ID mod (M-i)] and R[M-i-1] are exchanged; if the result of 2) is no, then perform 4);

4)设置i=i+1,重复步骤2)至4),直到i=M-2时结束。4) Set i=i+1, repeat steps 2) to 4), until i=M-2 and end.

经过上面处理后的数组R[0]...R[M-1]存放的是(0...M-1)的一个置换。则置换后的数组存放的数据序列为行标组。The array R[0]...R[M-1] after the above processing stores a permutation of (0...M-1). Then the data sequence stored in the permuted array is the row label group.

第二种方法The second method

如图4所示,见步骤S306至步骤S312,把0...M-1逆序放在数组A[0]...A[M-1]。然后执行下面的运算步骤:As shown in Figure 4, see step S306 to step S312, put 0...M-1 in the array A[0]...A[M-1] in reverse order. Then perform the following calculation steps:

1’)设置i=0;1') set i=0;

2’)判断ID mod(M-i)≠0是否成立;2') Determine whether ID mod(M-i)≠0 is established;

3’)如果2’)的判断结果为是,则将A[(ID mod(M-i))+i]和A[i]交换位置;如果2’)的判断结果为否,执行4’);3') If the judgment result of 2') is yes, then A[(ID mod(M-i))+i] and A[i] are exchanged; if the judgment result of 2') is No, execute 4');

4’)设置i=i+1,重复步骤2’)至4’),直到i=M-2时结束。4') Set i=i+1, repeat steps 2') to 4'), until i=M-2 and end.

经过上面处理后的数组A[0]...A[M-1]存放的是(0...M-1)的一个置换。则置换后的数组存放的数据序列为行标组。The array A[0]...A[M-1] after the above processing stores a permutation of (0...M-1). Then the data sequence stored in the permuted array is the row label group.

在图3所示的步骤S206和图4所示的步骤S306中,把0...M-1放在数组中的顺序可以是顺序存放、逆序存放、也可以是以随机的顺序存放。In step S206 shown in FIG. 3 and step S306 shown in FIG. 4 , the order of placing 0...M-1 in the array can be sequential storage, reverse storage, or random storage.

三、密钥的计算过程3. The calculation process of the key

在计算出所述标识对应的列标组和行标组后,从密钥因子矩阵中选取与所述的行标组和列标组对应的密钥因子(见步骤S107)。例如:设密钥因子矩阵的大小为16×64,即M=16,N=64,组成公私钥的密钥因子是按行从密钥因子矩阵中选取的。假如对于一个标识ID,根据上面给出的映射方法,可以计算出作为列标16个值为(8,2,62,......,33),相应的行标置换(3,8,1,......,12),于是在私钥因子矩阵中取S3,8,S8,2,S1,62,......,S12,33计算出ID对应的私钥;相应的标识ID对应的公钥从公钥因子矩阵中取P3,8,P8,2,P1,62,......,P12,33计算出。After calculating the column label group and row label group corresponding to the identifier, the key factor corresponding to the row label group and column label group is selected from the key factor matrix (see step S107). For example, if the size of the key factor matrix is 16×64, that is, M=16, N=64, the key factors forming the public and private keys are selected from the key factor matrix by row. If for an identification ID, according to the mapping method given above, it can be calculated that the 16 values as column labels are (8, 2, 62, ..., 33), and the corresponding row labels are replaced by (3, 8 , 1,...,12), then take S 3,8 , S 8,2 , S 1,62 ,..., S 12,33 in the private key factor matrix to calculate the ID The corresponding private key; the public key corresponding to the corresponding identification ID is calculated from the public key factor matrix by taking P 3,8 , P 8,2 , P 1,62 ,...,P 12,33 .

在得到标识对应的行标组和列标组后,再进行公私钥对的计算(见步骤S108)。After obtaining the row key group and column key group corresponding to the identifier, the public-private key pair is calculated (see step S108).

由于私钥是需要保密的,只有密钥管理中心才能保存私钥因子矩阵,私钥的生成只能在密钥管理中心进行,生成后发放给相应的实体,系统中的每个实体并不知道用于计算自身私钥的每个私钥因子;每个标识的公钥在整个密钥管理中心所管理的域内是公开的,所以公钥因子矩阵是需要公开的。Since the private key needs to be kept secret, only the key management center can save the private key factor matrix. The generation of the private key can only be carried out in the key management center. After the generation, it is issued to the corresponding entity. Each entity in the system does not know Each private key factor used to calculate its own private key; the public key of each identity is public in the domain managed by the entire key management center, so the public key factor matrix needs to be public.

在离散对数密码系统,系统参数T={g,p},其中p是素数,g是有限域Fp生成元,g小于p。一个标识ID对应的列标为C0,C1~CM-1,相应的行标为R0,R1~RM-1,S[Ri,Ci]为与标识对应的私钥因子,则标识ID对应的私钥:In the discrete logarithm cryptosystem, the system parameter T={g, p}, where p is a prime number, g is a generator of finite field F p , and g is smaller than p. The column corresponding to an identification ID is marked as C 0 , C 1 ~ C M-1 , the corresponding row is marked as R 0 , R 1 ~ R M-1 , and S[R i , C i ] is the private key corresponding to the identification factor, then identify the private key corresponding to the ID:

SKSK IDID == &Sigma;&Sigma; ii == 00 Mm SS [[ RR ii ,, CC ii ]] modmod pp ;;

对应的公钥:Corresponding public key:

PKPK IDID == &Pi;&Pi; ii == 00 Mm PP [[ RiRi ,, CiCi ]] modmod pp == (( gg SS [[ RR 00 ,, CC 00 ]] &times;&times; gg SS [[ RR 11 ,, CC 11 ]] .. .. .. &times;&times; gg SS [[ RR 3131 ,, CC 3131 ]] )) modmod pp

== (( gg SS [[ RR 00 ,, CC 00 ]] ++ SS [[ RR 11 ,, CC 11 ]] .. .. .. ++ SS [[ RR 3131 ,, CC 3131 ]] )) modmod pp == gg SKSK IDID modmod pp ;;

如果是椭圆曲线密码系统,系统参数T:(a,b,G,n,p),其中p是正整数,Fp是有限域,a,b是Fp上的正整数,G是椭圆曲线E(Fp)上的基点,n是素数,是基点G的阶。一个标识ID对应的列标为C0,C1~CM-1,相应的行标为R0,R1~RM-1,则标识ID对应的私钥:If it is an elliptic curve cryptosystem, the system parameter T: (a, b, G, n, p), where p is a positive integer, Fp is a finite field, a, b are positive integers on Fp, and G is the elliptic curve E(Fp ), n is a prime number, which is the order of the base point G. The column corresponding to an identification ID is labeled C 0 , C 1 ~C M-1 , and the corresponding row is labeled R 0 , R 1 ~ RM-1 , then the private key corresponding to the identification ID:

SKSK IDID == &Sigma;&Sigma; ii == 00 Mm SS [[ RR ii ,, CC ii ]] modmod nno ;;

对应的公钥:Corresponding public key:

SKSK IDID == &Sigma;&Sigma; ii == 00 Mm PP [[ RR ii ,, CC ii ]] modmod pp == SKSK IDID &times;&times; GG

实施例二Embodiment two

在本实施例中,根据图5对公私钥因子按列选取进行说明。公私钥因子无论是按行选取还是按列选取,其计算都是类似。In this embodiment, the selection of public and private key factors by column is described according to FIG. 5 . Whether the public-private key factor is selected by row or by column, its calculation is similar.

同样采用如图1A和图1B的私钥因子矩阵和公钥因子矩阵。执行本实施例的方法之前,系统中已经生成了大小为M×N的密钥因子矩阵,其中N=2n,M=2m。在本实施例中将密钥因子矩阵的大小表示为S=2m×N。本实施例的映射方法也分为三个过程:密钥因子矩阵的检验过程、行标组和列标组的计算过程和密钥的计算过程。The private key factor matrix and the public key factor matrix as shown in FIG. 1A and FIG. 1B are also used. Before executing the method of this embodiment, a key factor matrix with a size of M×N has been generated in the system, where N=2 n , M=2 m . In this embodiment, the size of the key factor matrix is expressed as S=2 m ×N. The mapping method in this embodiment is also divided into three processes: the verification process of the key factor matrix, the calculation process of the row label group and the column label group, and the calculation process of the key.

同样对于向IPv4、IPv6地址这类具有S bit的定长二进制标识和包含有由字母、数字等混合元素组成的非定长的二进制标识,本发明的映射方法都可以使用。在图5的流程图中,在实施本发明的映射方法之前,系统中已经生成了大小为M×N的密钥因子矩阵,其中N=2n,M=2m,m为正整数。如图5所示的标识为通用标识,需要将标识转换为二进制标识,并选取一部分作为下述步骤中的定长二进制标识(见步骤S401)。Similarly, the mapping method of the present invention can be used for fixed-length binary identifiers with S bits such as IPv4 and IPv6 addresses and non-fixed-length binary identifiers composed of mixed elements such as letters and numbers. In the flow chart of FIG. 5 , before implementing the mapping method of the present invention, a key factor matrix of size M×N has been generated in the system, where N=2 n , M=2 m , and m is a positive integer. The identifier shown in Figure 5 is a general identifier, which needs to be converted into a binary identifier, and a part is selected as a fixed-length binary identifier in the following steps (see step S401).

一、密钥因子矩阵的检验过程1. The verification process of the key factor matrix

密钥因子矩阵的检验过程与实施例一相同,只是在因子分解时,以密钥因子矩阵的列数N代替密钥因子矩阵的行数M。具体过程如图5的步骤S402、步骤S403和步骤S409:将定长二进制标识的长度值S按照S=N×r+k进行因子分解,其中k≥0且k<N;如果r≤m<S,则密钥因子矩阵可用;如果r>m,则所述密钥因子矩阵太小,需要重新生成密钥因子矩阵。The verification process of the key factor matrix is the same as the first embodiment, except that the number of columns of the key factor matrix N is used to replace the number of rows M of the key factor matrix during factorization. The specific process is as shown in step S402, step S403 and step S409 of Figure 5: factorize the length value S of the fixed-length binary identifier according to S=N×r+k, where k≥0 and k<N; if r≤m< S, the key factor matrix is available; if r>m, the key factor matrix is too small, and the key factor matrix needs to be regenerated.

二、行标组和列标组的计算过程2. Calculation process of row mark group and column mark group

在本实施例中由于是按列选取密钥因子,因此,需要现进行行标组的计算,再对列标组进行置换。In this embodiment, since the key factor is selected by column, it is necessary to calculate the row label group now, and then replace the column label group.

首先,进行行标组的计算。First, calculate the row label group.

在上述的密钥因子矩阵的检验过程中,已经将定长二进制标识ID按照S=N×r+k进行因子分解,其中k≥0且k<N,N为密钥因子矩阵的列数。因为已经经过了密钥因子矩阵的检验过程,因此,该公式中的r≤m<S。通过所述的定长二进制标识ID来计算行标组同样有三种方法:In the above verification process of the key factor matrix, the fixed-length binary ID has been factorized according to S=N×r+k, where k≥0 and k<N, and N is the number of columns of the key factor matrix. Because the verification process of the key factor matrix has been passed, r≤m<S in this formula. There are also three methods to calculate the row label group through the fixed-length binary ID:

第一种方法(图中未示出)是按照如下的公式计算行标组Ci(ID):The first method (not shown in the figure) is to calculate the line label group C i (ID) according to the following formula:

如果k<m-r,Ci(ID)=[ID>>(i×r)]&(2m-1),i=0...N-1If k<mr, C i (ID)=[ID>>(i×r)]&(2 m -1), i=0...N-1

其中,>>表示循环移位运算;Among them, >> represents the circular shift operation;

如果k≥m-r,Ci(ID)=[ID>>(i×r)]&(2m-1),i=0...N-[k-(m-r)]-1,If k≥mr, C i (ID)=[ID>>(i×r)]&(2 m -1), i=0...N-[k-(mr)]-1,

Ci(ID)={ID>>[i×(r+1)]}&(2m-1),i=M-[k-(m-r)]...N-1,C i (ID)={ID>>[i×(r+1)]}&(2 m -1), i=M-[k-(mr)]...N-1,

其中,>>表示循环移位运算。Among them, >> represents a circular shift operation.

第二种方法(图中未示出)按照如下的公式计算行标组Ci(ID):The second method (not shown in the figure) calculates the line label group C i (ID) according to the following formula:

Ci(ID)={ID>>[i×(r+1)]}&(2m-1),i=0...N-1C i (ID)={ID>>[i×(r+1)]}&(2 m -1), i=0...N-1

其中,>>表示循环移位运算。Among them, >> represents a circular shift operation.

第三种方法,见图5中的步骤S405,按照如下的公式计算行标组Ci(ID),The third method, see step S405 among Fig. 5, calculate line label group C i (ID) according to the following formula,

Ci(ID)=[ID>>(i×r’)]&(2m-1),i=0...N-1C i (ID)=[ID>>(i×r')]&(2 m -1), i=0...N-1

其中,>>表示循环移位运算,S>r’>r,要求r’不是S的因子。Among them, >> means circular shift operation, S>r'>r, and r' is not required to be a factor of S.

接着,进行列标组的计算。Next, calculate the column label group.

密钥因子从密钥因子矩阵的每一列选取一个,因此列标组是(0...N-1)的一个置换,最简单的方式就是直接选取0...N-1(图中未示出)。此外,同样进行置换也可以通过实施例一中的两种方法稍作变化即可:The key factor is selected from each column of the key factor matrix, so the column label group is a permutation of (0...N-1), the easiest way is to directly select 0...N-1 (not shown in the figure Shows). In addition, the same replacement can also be slightly changed through the two methods in Example 1:

第一种方法(图中未示出),把0...N-1顺序存放、逆序存放或以随机的顺序存放在数组R[0]...R[N-1]。然后执行下面的运算步骤:The first method (not shown in the figure) is to store 0...N-1 sequentially, reversely or randomly in the array R[0]...R[N-1]. Then perform the following calculation steps:

1)设置i=0;1) set i=0;

2)判断ID mod(N-i)<N-i-1是否成立;2) Determine whether ID mod(N-i)<N-i-1 is established;

3)如果2)的结果为是,则将R[ID mod(N-i)]和R[N-i-1]交换位置;如果2)的结果为否,则执行4);3) If the result of 2) is yes, then R[ID mod (N-i)] and R[N-i-1] are exchanged; if the result of 2) is no, then perform 4);

4)设置i=i+1,重复步骤2)至4),直到i=N-2时结束。4) Set i=i+1, repeat steps 2) to 4), until i=N-2 and end.

经过上面处理后的数组R[0]...R[N-1]存放的是(0...N-1)的一个置换。则置换后的数组存放的数据序列为列标组。The array R[0]...R[N-1] processed above stores a permutation of (0...N-1). Then the data sequence stored in the permuted array is a column label group.

如图5的步骤S406至步骤S412所示为第二种方法,把0...N-1顺序存放、逆序存放或以随机的顺序存放在数组A[0]...A[N-1]。然后执行下面的运算步骤:As shown in steps S406 to S412 in Figure 5, the second method is to store 0...N-1 sequentially, in reverse order, or in random order in the array A[0]...A[N-1 ]. Then perform the following calculation steps:

1’)设置i=0;1') set i=0;

2’)判断ID mod(N-i)≠0是否成立;2') Determine whether ID mod(N-i)≠0 is established;

3’)如果2’)的结果为是,则将A[(ID mod(N-i))+i]和A[i]交换位置;如果2’)的结果为否,则执行4’);3') If the result of 2') is yes, then exchange positions of A[(ID mod(N-i))+i] and A[i]; if the result of 2') is no, then execute 4');

4’)设置i=i+1,重复步骤2’)至4’),直到i=N-2时结束。4') Set i=i+1, repeat steps 2') to 4'), until i=N-2 and end.

经过上面处理后的数组A[0]...A[N-1]存放的是(0...N-1)的一个置换。则置换后的数组存放的数据序列为列标组。The array A[0]...A[N-1] after the above processing stores a permutation of (0...N-1). Then the data sequence stored in the permuted array is a column label group.

三、密钥的计算过程与实施例一相同,在此不再赘述。3. The calculation process of the key is the same as that of the first embodiment, and will not be repeated here.

通过本发明,简化了标识到密钥的映射方法,映射方法简洁高效,易于实现,而且对于IPv4、IPv6这类的标识可以实现标识到密钥的无冲突映射。The invention simplifies the mapping method from the identification to the key, and the mapping method is simple, efficient and easy to implement, and can realize the conflict-free mapping from the identification to the key for identifications such as IPv4 and IPv6.

上述实施例仅用于说明本发明,而非用于限定本发明。The above-mentioned embodiments are only used to illustrate the present invention, but not to limit the present invention.

Claims (24)

1. A method for mapping identities and keys, applied in a combined identity-based key management system in which a key factor matrix has been generated, the method comprising the steps of:
step 1, checking the size of a key factor matrix according to the length value of a fixed-length binary identifier or a fixed-length binary identifier converted from a non-fixed-length binary identifier, wherein the size of the key factor matrix is expressed as Mx 2n(ii) a Wherein, include: factoring the length value of the fixed-length binary mark according to a formula, a table of the formulaThe expression is as follows: s is mxr + k; wherein, S: length value of the fixed-length binary mark; m: the number of rows of the key factor matrix; 2n: the number of columns of the key factor matrix; k is more than or equal to 0 and is less than M; s, M, k, r and n are integers; judging whether the size of the key factor matrix is proper or not according to the factorization result; if the judgment result is appropriate, executing the step 2;
step 2, calculating corresponding row mark groups and column mark groups of the key factors in the key factor matrix according to the fixed-length binary marks; wherein, include: calculating a column mark group corresponding to the fixed-length binary mark; replacing all row marks of the key factor matrix to obtain a row mark group corresponding to the fixed-length binary mark;
and 3, calculating a key corresponding to the fixed-length binary identification by using the key factors corresponding to the row mark group and the column mark group.
2. The identifier and key mapping method according to claim 1, wherein the step 1 further comprises: and if the judgment result is not suitable, regenerating the key factor matrix.
3. The identifier and key mapping method of claim 1, wherein determining whether the size of the key factor matrix is appropriate is:
judging whether r is larger than n; if the judgment result is that r is not more than n and is less than S, the size of the key factor matrix is proper;
if the judgment result is that r is larger than n, the size of the key factor matrix is not appropriate;
wherein, S: length value of the fixed-length binary mark; n and r are integers.
4. The identifier and key mapping method of claim 1, wherein said computing a set of tokens corresponding to a fixed-length binary identifier comprises:
judging whether k is more than n-r;
if the judgment result is yes, calculating the column marks according to a formulaGroup Ci(ID), the expression of this formula is: ci(ID)=[ID>>(i×r)]&(2n-1), i ═ 0 … M-1; wherein > represents a cyclic shift operation, and ID is the fixed-length binary identifier;
if the judgment result is negative, calculating the list mark group C according to a formulai(ID), the formula expression is:
Ci(ID)=[ID>>(i×r)]&(2n-1),i=0...M-[k-(n-r)]-1, and
Ci(ID)={ID>>[i×(r+1)]}&(2n-1),i=M-[k-(n-r)]…M-1;
wherein > represents a cyclic shift operation, and ID is the fixed-length binary identifier; m, k, n, r and i are integers.
5. The identifier and key mapping method of claim 1, wherein said computing a set of tokens corresponding to a fixed-length binary identifier comprises:
calculating the list group C according to a formulai(ID), the formula expression is:
Ci(ID)={ID>>[i×(r+1)]}&(2n-1),i=0...M-1;
where > denotes a circular shift operation; ID is a fixed-length binary identification; n, r and i are integers.
6. The identifier and key mapping method of claim 1, wherein said computing a set of tokens corresponding to a fixed-length binary identifier comprises:
calculating the list group C according to a formulai(ID), the formula expression is:
Ci(ID)=[ID>>(i×r’)]&(2n-1),i=0...M-1
wherein, the > represents the circular shift operation, S > r 'is greater than r, r' is not the factor of S, ID is the fixed-length binary system identification; s is the length value of the fixed-length binary mark; r, r', n and i are integers.
7. The identifier and key mapping method of claim 1, wherein the permuting all row labels of the key factor matrix comprises:
directly selecting a data sequence as a row mark group, wherein the data sequence is as follows: 0, 1,..., M-1, where M is the number of rows of the key factor matrix.
8. The identifier and key mapping method of claim 1, wherein the permuting all row labels of the key factor matrix comprises:
storing data sequences in sequence, reverse sequence or random sequence in an array R [ i ], wherein the data sequences are as follows: 0, 1.... am-1;
wherein i is 0, 1,.. am-1; m is the number of rows in the key factor matrix.
9. The identifier and key mapping method of claim 8, wherein the step of permuting all row labels of the key factor matrix further comprises the steps of:
step 11, setting i to 0;
step 12, judging whether the ID mod (M-i) < M-i-1 is established or not;
step 13, if the judgment result in the step 12 is yes, exchanging the positions of R [ ID mod (M-i) ] and R [ M-i-1 ]; if the judgment result in the step 12 is negative, executing a step 14;
step 14, setting i to i +1, and judging whether i is equal to M-2;
step 15, if the judgment result in the step 14 is negative, repeating the steps 12 to 15; if the result of the determination in step 14 is yes, the replacement is ended, and the array R [ i ] processed in the above step stores a replacement of (0 … M-1).
10. The identifier and key mapping method of claim 8, wherein the step of permuting all row labels of the key factor matrix further comprises the steps of:
step 21, setting i to 0;
step 22, judging whether ID mod (M-i) ≠ 0 is true;
step 23, if the judgment result in step 22 is yes, exchanging the positions of R [ (ID mod (M-i)) + i ] and R [ i ]; if the judgment result in the step 22 is negative, executing a step 24;
step 24, setting i to i +1, and judging whether i is equal to M-2;
step 25, if the judgment result in the step 24 is negative, repeating the steps 22 to 25; if the judgment result in the step 24 is yes, the replacement is finished, and the array R [ i ] processed by the above steps stores a replacement of (0.. M-1).
11. A method for mapping identities and keys, applied in a combined identity-based key management system in which a key factor matrix has been generated, the method comprising the steps of:
step 1, checking the size of a key factor matrix according to the length value of a fixed-length binary identifier or a fixed-length binary identifier converted from a non-fixed-length binary identifier, wherein the size of the key factor matrix is expressed as 2mX is N; wherein, include: factoring the length value of the fixed-length binary mark according to a formula, wherein the formula has the expression: s is N × r + k; wherein, S: length value of the fixed-length binary mark; 2m: the number of rows of the key factor matrix; n: the number of columns of the key factor matrix; k is more than or equal to 0 and k is less than N; s, N, k, r and m are integers; judging whether the size of the key factor matrix is proper or not according to the factorization result; if the judgment result is appropriate, executing the step 2;
step 2, calculating corresponding row mark groups and column mark groups of the key factors in the key factor matrix according to the fixed-length binary marks; wherein, include: calculating a row mark group corresponding to the fixed-length binary mark; replacing all the column marks of the key factor matrix to obtain a column mark group corresponding to the fixed-length binary mark;
and 3, calculating a key corresponding to the fixed-length binary identification by using the key factors corresponding to the row mark group and the column mark group.
12. The identifier and key mapping method according to claim 11, wherein the step 1 further comprises: and if the judgment result is not suitable, regenerating the key factor matrix.
13. The identifier and key mapping method of claim 11, wherein determining whether the size of the key factor matrix is appropriate comprises:
judging whether r is larger than m; if the judgment result is that r is not more than m and is less than S, the size of the key factor matrix is proper;
if the judgment result is that r is larger than m, the size of the key factor matrix is not appropriate;
wherein, S: length value of the fixed-length binary mark; m and r are integers.
14. The identifier and key mapping method of claim 11, wherein said computing a set of row labels corresponding to a fixed-length binary identifier comprises:
judging whether k is more than m-r;
if the judgment result is yes, calculating a line mark group C according to a formulai(ID), the expression of this formula is:
Ci(ID)=[ID>>(i×r)]&(2m-1),i=0…N-1;
if the judgment result is negative, calculating the line mark group C according to a formulai(ID), the formula expression is:
Ci(ID)=[ID>>(i×r)]&(2m-1),i=0…N-[k-(m-r)]-1, and
Ci(ID)={ID>>[i×(r+1)]}&(2m-1),i=N-[k-(m-r)]…N-1;
wherein > represents a cyclic shift operation, and ID is the fixed-length binary identifier; n, k, r, m and i are integers.
15. The identifier and key mapping method of claim 11, wherein said computing a set of row labels corresponding to a fixed-length binary identifier comprises:
calculating line symbol group C according to formulai(ID), the formula expression is:
Ci(ID)={ID>>[i×(r+1)]}&(2m-1),i=0...N-1;
wherein > represents a cyclic shift operation, and ID is the fixed-length binary identifier; n, r, m and i are integers.
16. The identifier and key mapping method according to claim 1 or 11, wherein said calculating a set of row labels corresponding to a fixed-length binary identifier comprises:
calculating line symbol group C according to formulai(ID), the formula expression is:
Ci(ID)=[ID>>(i×r’)]&(2m-1),i=0...N-1
wherein, the > represents the cyclic shift operation, S > r '> r, r' is not the factor of S, ID is the fixed-length binary mark; r', r, m and i are integers.
17. The identifier and key mapping method according to claim 1 or 11, wherein the permuting all the columns of the key factor matrix comprises:
directly selecting a data sequence as a list mark group, wherein the data sequence is as follows: 0, 1.
18. The identifier and key mapping method according to claim 1 or 11, wherein the permuting all the columns of the key factor matrix comprises:
storing data sequences in sequence, reverse sequence or random sequence in an array R [ i ], wherein the data sequences are as follows: 0, 1...., N-1;
wherein i is 0, 1, a. N is the number of columns of the key factor matrix.
19. The identifier and key mapping method of claim 18, wherein the step of permuting all columns of the key factor matrix further comprises the steps of:
step 31, setting i to 0;
step 32, judging whether the ID mod (N-i) < N-i-1 is established;
step 33, if the judgment result in the step 32 is yes, exchanging the positions of R [ ID mod (N-i) ] and R [ N-i-1 ]; if the judgment result in the step 32 is negative, executing a step 34;
step 34, setting i to i +1, and judging whether i is equal to N-2;
step 35, if the judgment result in the step 34 is negative, repeating the steps 32 to 35; if the result of the determination in step 34 is YES, the permutation is finished, and the array R [ i ] processed in the above step stores a permutation of (0 … M-1).
20. The identifier and key mapping method of claim 18, wherein the step of permuting all columns of the key factor matrix further comprises the steps of:
step 41, setting i to 0;
step 42, judging whether ID mod (N-i) ≠ 0 is true;
step 43, if the judgment result in step 42 is yes, exchanging the positions of R [ (ID mod (N-i)) + i ] and R [ i ]; if the judgment result of the step 42 is negative, executing a step 44;
step 44, setting i to i +1, and judging whether i is equal to N-2;
step 45, if the result of step 44 is negative, repeating steps 42 to 45; if the result of step 44 is YES, the permutation is complete and the array R [ i ] processed by the above steps stores a permutation of (0 … M-1).
21. The identifier and key mapping method according to claim 1 or 11, wherein said step 3 comprises:
selecting key factors corresponding to the row mark groups and the column mark groups from the key factor matrix;
and calculating a key corresponding to the fixed-length binary identification by using the key factor.
22. The method for identifier and key mapping according to claim 21, wherein in a discrete logarithm cryptosystem, the key is calculated according to a formula using a key factor; wherein,
according to the formula <math> <mrow> <msub> <mi>SK</mi> <mi>ID</mi> </msub> <mo>=</mo> <munderover> <mi>&Sigma;</mi> <mrow> <mi>i</mi> <mo>=</mo> <mn>0</mn> </mrow> <mi>M</mi> </munderover> <mi>S</mi> <mo>[</mo> <msub> <mi>R</mi> <mi>i</mi> </msub> <mo>,</mo> <msub> <mi>C</mi> <mi>i</mi> </msub> <mo>]</mo> <mi>mod</mi> <mi>p</mi> </mrow> </math> Computing the private Key SKID
According to the formula PK ID = g SK ID mod p Computing public key PKID
Wherein p and g are parameters of the discrete logarithm cryptosystem, p is prime number, g is finite field Fp generator, g is less than p, RiFor line marking, CiIs a list, SRi,Ci]Is the private key factor corresponding to the identity.
23. The method for identifier and key mapping according to claim 21, wherein in an elliptic curve cryptosystem, the key is calculated according to a formula using a key factor; wherein,
according to the formula <math> <mrow> <msub> <mi>SK</mi> <mi>ID</mi> </msub> <mo>=</mo> <munderover> <mi>&Sigma;</mi> <mrow> <mi>i</mi> <mo>=</mo> <mn>0</mn> </mrow> <mi>M</mi> </munderover> <mi>S</mi> <mo>[</mo> <msub> <mi>R</mi> <mi>i</mi> </msub> <mo>,</mo> <msub> <mi>C</mi> <mi>i</mi> </msub> <mo>]</mo> <mi>mod</mi> <mi>n</mi> </mrow> </math> Computing the private Key SKID
According to formula SKID=SKIDX G calculation public key PKID
Wherein n and G are parameters of the elliptic curve cryptosystem, G is a base point on an elliptic curve E (Fp), n is a prime number, n is the order of the base point G, and R isiFor line marking, CiIs a list, SRi,Ci]Is the private key factor corresponding to the identity.
24. The identifier and key mapping method according to claim 1 or 11, wherein a hash function or a message authentication code function is used to convert the non-fixed-length binary identifier into a fixed-length binary identifier.
CN200610115440A 2006-08-09 2006-08-09 A Mapping Method of ID and Key Expired - Fee Related CN100589375C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200610115440A CN100589375C (en) 2006-08-09 2006-08-09 A Mapping Method of ID and Key

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200610115440A CN100589375C (en) 2006-08-09 2006-08-09 A Mapping Method of ID and Key

Publications (2)

Publication Number Publication Date
CN1909445A CN1909445A (en) 2007-02-07
CN100589375C true CN100589375C (en) 2010-02-10

Family

ID=37700444

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200610115440A Expired - Fee Related CN100589375C (en) 2006-08-09 2006-08-09 A Mapping Method of ID and Key

Country Status (1)

Country Link
CN (1) CN100589375C (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101420300B (en) * 2008-05-28 2013-05-29 北京易恒信认证科技有限公司 Double factor combined public key generating and authenticating method
CN105897405B (en) * 2016-06-02 2019-04-05 北京赛思信安技术股份有限公司 128 Symmetric key generations of one kind and protective device
CN110490338A (en) * 2019-08-19 2019-11-22 蘑菇物联技术(深圳)有限公司 A kind of electromechanical equipment genuine part method of calibration based on cloud computing
CN114065188A (en) * 2021-10-18 2022-02-18 北京迪曼森科技有限公司 Key seed matrix, certificateless anti-collision key generation method based on the matrix

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
An Identity Based Encryption system. Louise Owens, et al.Proceedings of the 3rd international symposium on Principles and practice of programming in Java. 2004 *
基于椭圆曲线密码系统的组合公钥技术. 唐文等.计算机工程与应用,第21期. 2003 *

Also Published As

Publication number Publication date
CN1909445A (en) 2007-02-07

Similar Documents

Publication Publication Date Title
CN111492616B (en) Configurable device for lattice-based cryptography
CN108418686B (en) A multi-distributed SM9 decryption method and medium and key generation method and medium
CN107395368B (en) Digital signature method, decapsulation method and decryption method in media-free environment
CN101447980B (en) Collision-resistance method for mapping public-private key pairs by utilizing uniform user identification
CN108183791B (en) Intelligent terminal data security processing method and system applied to cloud environment
CN103051446B (en) A kind of key encrypting and storing method
CN105790941A (en) Identity-based combined key generation and authentication method with field partition
CN101626364A (en) Method for authentication for resisting secrete data disclosure and key exchange based on passwords
CN100589375C (en) A Mapping Method of ID and Key
CN111010276A (en) A multi-party joint SM9 key generation, ciphertext decryption method and medium
JP2011528876A (en) Data security access method suitable for electronic tags
KR20090104421A (en) Elliptic Curve Password-Based Key Setting Method in Wireless Sensor Network and Wireless Sensor Network System and Recording Media
CN113285959A (en) Mail encryption method, decryption method and encryption and decryption system
CN113660087A (en) A Hardware Implementation System of SM9 Identification Cryptographic Algorithm Based on Finite Field
CN101951314A (en) Design method of S-box in symmetric password encryption
CN110784300B (en) A Key Synthesis Method Based on Multiplicative Homomorphic Encryption
CN1905438B (en) An identity-based combined key management method and system
CN107425971A (en) Terminal and its data method for encryption/decryption and device without certificate
CN116707804B (en) Method and equipment for enhancing FF1 format reserved encryption security
CN115801224B (en) Fully homomorphic encryption method supporting floating point number operation in cloud computing environment
CN105763333A (en) Method and system for negotiating asymmetric key
CN112152813A (en) Certificateless content extraction signcryption method supporting privacy protection
WO2024234523A1 (en) Sampling method for high-precision variance distribution of lattice-based password
CN108270565A (en) A kind of data mixing encryption method
CN110855425A (en) Lightweight multiparty cooperative SM9 key generation and ciphertext decryption method and medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100210

Termination date: 20150809

EXPY Termination of patent right or utility model