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

📄 加密算法与密钥管理.htm

📁 是加密算法
💻 HTM
📖 第 1 页 / 共 2 页
字号:
的复杂操作已经在很多著作中有过详细的描述,这里不再赘述。一个需要注意的问题是 

对尾部碎片的处理方法。传统的做法是填充数据而使其成为一个整组,这种处理方法会 

使数据扩张,不适用于数据库加密。为此我们采用了“密码挪用法”来解决这个问题。</font>





<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">在该例中,待加密数据的长度为13。第一整组(1~8 

码)加密后截取第6~8码的密文与尾部(9~13码)组成一个整组进行加密,加密所 

得密码接在前一组的第5个密码之后。其中,第6~8码实际上进行了二次加密,在脱密 

时也应该进行二次脱密。这种方案一方面保证了64位分组加密,同时又保证了数据库加 

密以后,数据长度不会变化。</font><p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">另外,关系数据库中有些数据比较短,例如人事档案表中 

“性别”字段,一般只定义一个汉字(16bit)。这类数据长度不到一个分组,如果不进 

行数据扩张,其密码强度会减弱,需要进行特殊处理。因此,当用户要求对这类数据加 

密时,系统将自动检查并将其定义为二进制64分位定长数据类型,加密时,实际数据不 

足一组的部分用随机数填满。</font> 

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">加密数据的数据类型需要处理,否则数据库管理系统将会 

因加密后的数据不符合定义的数据类型而拒绝加载。解决方法之一是另外建立密文表用 

于存放密文。凡是需要加密的数据都定义为计算机二进制数据类型。加密以后插入数据 

库的数据全部为二进制数据类型的数据,当用户检索时,加密系统自动脱密并转换成用 

户所需要的数据类型。</font> 

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">加密系统为数据库用户提供了定义加密要求的手段。通过 

系统提供的用户界面,用户可以选择需要加密的数据库表,并确定该表需要加密的列数 

据。</font><p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">当应用系统输入一条数据库表记录时,系统查得该表的加 

密要求,如果需要加密,则对需要加密的列数据进行加密,然后将得到的密文插入到数 

据库表中。如果该表不需要加密,则将明文直接插入到数据库表中。</font> 

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">当应用系统查得一条数据库表记录时,如果是明文(该表 

没有加密要求),则直接将明文记录交付给用户;如果有加密要求,则将每个需要脱密 

的列数据脱密,并将所得到的明文交付给用户。</font> 

<h3 style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0">  

</h3> 

<h3 style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">密钥管理方法</font>

</h3>

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font color="#ffffff"><font size="2">----</font></font>

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">数据库加密需要实行二级密钥管理。一级密钥为主密 

钥,二级密钥为工作密钥。主密钥的作用是对二级密钥信息加密生成工作密钥。工作密 

钥用于对数据库数据的加/脱密。工作密钥信息的长度为64位,前56位是记录名,需要 

带校验地存储在数据库表中。后8位是数据库表的列(字段)信息(该字段在表中的某些 

特征),它们是临时生成的。为了存储记录名数据,每个数据库表增加了一个记录名字段, 

在用户录入数据时,系统自动生成记录名数据,使每条记录都有一个记录名并做到各记 

录名数据互不重复。</font></p> 

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">设一个表有m列、n条记录,则对于每一个加密单位都 

有一个对应的二级密钥信息XiYj.</font></p>

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">其中,Xi占56位(bit), X序列的周期为256-1≈7 

×1016。</font> 

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">Yj占8位(bit),允许列编号0~255,即一个数据库表 

最多允许256列数据。</font> 

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">XiYj的总长度为56+8=64位(bit)。在数据需要加/ 

脱密时,将相应的64位二级密钥信息用主密钥进行加密即得到工作密钥,用工作密钥完 

成对数据的加/脱密。</font><p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">举例来说,如果一年需要1×109条记录,在足够长的时 

间内可提供不重复的X序列:</font><p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">(7×1016)÷(1×109)=7×107(年)。这在足 

够长的时间内保证了Xi信息的两两互异。目前Sybase DBMS规定,一个数据库表的列数 

不超过256列,这就保证了Yj信息的两两互异。由此保证了XiYj信息的两两互异,也就 

证明了工作密钥的唯一性。</font><p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">事实上,数据库加密系统中还需要其他一些密钥信息。例 

如对于多服务器、多数据库、多用户、多用户组等情况,还需要根据应用需求增添一些 

信息,其方法是将以上各类实体分别进行编码、存储并依据不同情况使用。</font> 

<h3 style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0">  

</h3> 

<h3 style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">密钥的安全保护</font>

</h3>

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font color="#ffffff"><font size="2">----</font></font>

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">理论上讲,实现了“一次一密”密钥管理的密码是不可 

破译的,因此如何确保密钥管理系统的安全成为关键问题。本系统中,主密钥保护了工 

作密钥,工作密钥保护敏感信息,因而整个系统的安全依赖于主密钥的安全。</font></p> 

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">主密钥的安全需要解决以下几个问题:</font>

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">1. 主密钥的生成</font> 

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">本系统采用投币法产生64位二进制数据。</font>

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">2. 主密钥的存储</font><p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">主密钥经加密并存放于安全区域内,使用时由系统自动获 

取并脱密。本系统也可将主密钥注入加密卡中以利安全。</font> 

<p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">3. 主密钥的更换</font><p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">在数据库加密课题中,主密钥的更换是一个比较棘手的问 

题。主密钥更换以后,会造成工作密钥的全部更换。数据库中存储着海量数据,已经加 

密的数据需要用原来的密钥系统脱密,而且脱密时间将会很长。为安全起见,密钥更换 

前,需对数据库系统进行全库备份,然后利用系统所提供的工具完成对数据库中密数据 

向明数据的转换。更换主密钥后,再根据数据库加密要求进行明数据向密数据的转换。</font><p style="text-indent: 21; line-height: 17pt; margin-top: 0; margin-bottom: 0"><font size="2">在大型数据库中,这种明密数据的转换工作需要认真对 

待。首先应该制定计划,做好充分的准备工作。对所做的工作应做好登记,使密钥更换 

工作有条不紊地进行。事实上,由上面密钥系统的应用分析可以知道,即使不变更主密 

钥,也可以在足够长的时间内保证Xi信息的两两互异,也就是说,在通常的数据库生存 

期内,不变更主密钥也能充分保证加密系统密钥使用的“一次一密”。只要系统管理得 

当,密钥系统仅需数年更换一次,或者不必更换。 </font>

</body>

</html>

⌨️ 快捷键说明

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