
什么叫加密技术?
4个回答
展开全部
加密技术是最常用的安全保密手段,利用技术手段把重要的数据变为乱码(加密)传送,到达目的地后再用相同或不同的手段还原(解密)。
加密技术包括两个元素:算法和密钥。算法是将普通的信息或者可以理解的信息与一串数字(密钥)结合,产生不可理解的密文的步骤,密钥是用来对数据进行编码和解密的一种算法。在安全保密中,可通过适当的钥加密技术和管理机制来保证网络的信息通信安全。
加密技术包括两个元素:算法和密钥。算法是将普通的信息或者可以理解的信息与一串数字(密钥)结合,产生不可理解的密文的步骤,密钥是用来对数据进行编码和解密的一种算法。在安全保密中,可通过适当的钥加密技术和管理机制来保证网络的信息通信安全。
展开全部
以某种特殊的算法改变原有的信息数据,使得未授权的用户即使获得了已加密的信号,但因不知解密的方法,仍然无法了解信息的内容。
加密建立在对信息进行数学编码和解码的基础上。加密类型分为两种,对称加密与非对称加密,对称加密双方采用共同密钥,(当然这个密钥是需要对外保密的),这里讲一下非对称加密,这种加密方式存在两个密钥,密钥 -- 一种是公共密钥(正如其名,这是一个可以公开的密钥值),一种是私人密钥(对外保密)。 您发送信息给我们时,使用公共密钥加密信息。 一旦我们收到您的加密信息,我们则使用私人密钥破译信息密码(被我们的公钥加密的信息,只有我们的唯一的私钥可以解密,这样,就在技术上保证了这封信只有我们才能解读——因为别人没有我们的私钥)。 使用私人密钥加密的信息只能使用公共密钥解密(这一功能应用与数字签名领域,我的私钥加密的数据,只有我的公钥可以解读,具体内容参考数字签名的信息)反之亦然,以确保您的信息安全。
举例如下:
代码如下:
/* Secure.c
Copyright (c) 2002, 2006 by ctu_85
All Rights Reserved.
*/
#include "stdio.h"
#include "string.h"
#define right 5
void Create();
void Load();
char secure(char);
char desecure(char);
void main()
{
int choice;
printf("Please enter your choice:\n");
printf("0:To quit;\n");
printf("1:To create a security file;\n");
printf("2:To load a security file .\n");
cir:
printf("Your choice:");
scanf("%d",&choice);
if(choice==0)
return;
if(choice==1)
{
Create();
printf("\n");
goto cir;
}
else
if(choice==2)
{
Load();
printf("\n");
goto cir;
}
else
{
printf("Invalid input!\n");
goto cir;
}
}
void Create()
{
FILE *fp;
char *p,ch,*s;
recre:
printf("Please enter the path where you wanna the file to be:");
scanf("%s",p);
if(*p<'C'||*p>'F'||*(p+1)!=':'||*(p+2)!=92||strlen(p)>30||strlen(p)<4)
{
printf("Invalid input!\n");
goto recre;
}
if((fp=fopen(p,"wb"))==NULL)
{
printf("Error!");
return;
}
an:
printf("Please set the password:");
scanf("%s",s);
if(strlen(s)>16||strlen(s)<6)
{
printf("The password is too long or too short,please reinput!\n");
goto an;
}
while(*s!='')
{
ch=*s;
ch=secure(ch);
s++;
fputc(ch,fp);
}
ch='\n';
ch=secure(ch);
fputc(ch,fp);
printf("Please enter the information,end with char '#':");
ch=getchar();
ch=getchar();
while(ch!='#')
{
ch=secure(ch);
fputc(ch,fp);
ch=getchar();
}
ch=secure(ch);
fputc(ch,fp);
fclose(fp);
}
void Load()
{
FILE *fp;
char *p,ch,*s,temp[18],pass[18],sign=secure('\n');
int i=0,t=0,lenth=0;
rece:
printf("Please enter the path where you wanna to load:");
scanf("%s",p);
if(*p<'C'||*p>'F'||*(p+1)!=':'||*(p+2)!=92||strlen(p)>30||strlen(p)<4)
{
printf("Invalid input!\n");
goto rece;
}
if((fp=fopen(p,"rb"))==NULL)
{
printf("Error!");
return;
}
ant:
printf("Please input the password:");
scanf("%s",s);
lenth=strlen(s);
if(lenth>16||lenth<6)
{
printf("The password is obviously incorrect!\n");
goto ant;
}
while(*s!='')
{
temp=secure(*s);
s++;
i++;
}
temp='';
ch=fgetc(fp);
while(ch!=sign)
{
pass[t]=ch;
t++;
ch=fgetc(fp);
}
pass[t]='';
ch=desecure(ch);
if(!strcmp(temp,pass))
{
while(ch!='#')
{
ch=fgetc(fp);
ch=desecure(ch);
if(ch!='#')
putchar(ch);
}
}
else
printf("The password is incorrect!\n");
fclose(fp);
}
char secure(char c)
{
if(c+right>254)
return c-255+right;
else
return c+right;
}
char desecure(char c)
{
if(c<right)
return 255-right;
else
return c-right;
}
加密建立在对信息进行数学编码和解码的基础上。加密类型分为两种,对称加密与非对称加密,对称加密双方采用共同密钥,(当然这个密钥是需要对外保密的),这里讲一下非对称加密,这种加密方式存在两个密钥,密钥 -- 一种是公共密钥(正如其名,这是一个可以公开的密钥值),一种是私人密钥(对外保密)。 您发送信息给我们时,使用公共密钥加密信息。 一旦我们收到您的加密信息,我们则使用私人密钥破译信息密码(被我们的公钥加密的信息,只有我们的唯一的私钥可以解密,这样,就在技术上保证了这封信只有我们才能解读——因为别人没有我们的私钥)。 使用私人密钥加密的信息只能使用公共密钥解密(这一功能应用与数字签名领域,我的私钥加密的数据,只有我的公钥可以解读,具体内容参考数字签名的信息)反之亦然,以确保您的信息安全。
举例如下:
代码如下:
/* Secure.c
Copyright (c) 2002, 2006 by ctu_85
All Rights Reserved.
*/
#include "stdio.h"
#include "string.h"
#define right 5
void Create();
void Load();
char secure(char);
char desecure(char);
void main()
{
int choice;
printf("Please enter your choice:\n");
printf("0:To quit;\n");
printf("1:To create a security file;\n");
printf("2:To load a security file .\n");
cir:
printf("Your choice:");
scanf("%d",&choice);
if(choice==0)
return;
if(choice==1)
{
Create();
printf("\n");
goto cir;
}
else
if(choice==2)
{
Load();
printf("\n");
goto cir;
}
else
{
printf("Invalid input!\n");
goto cir;
}
}
void Create()
{
FILE *fp;
char *p,ch,*s;
recre:
printf("Please enter the path where you wanna the file to be:");
scanf("%s",p);
if(*p<'C'||*p>'F'||*(p+1)!=':'||*(p+2)!=92||strlen(p)>30||strlen(p)<4)
{
printf("Invalid input!\n");
goto recre;
}
if((fp=fopen(p,"wb"))==NULL)
{
printf("Error!");
return;
}
an:
printf("Please set the password:");
scanf("%s",s);
if(strlen(s)>16||strlen(s)<6)
{
printf("The password is too long or too short,please reinput!\n");
goto an;
}
while(*s!='')
{
ch=*s;
ch=secure(ch);
s++;
fputc(ch,fp);
}
ch='\n';
ch=secure(ch);
fputc(ch,fp);
printf("Please enter the information,end with char '#':");
ch=getchar();
ch=getchar();
while(ch!='#')
{
ch=secure(ch);
fputc(ch,fp);
ch=getchar();
}
ch=secure(ch);
fputc(ch,fp);
fclose(fp);
}
void Load()
{
FILE *fp;
char *p,ch,*s,temp[18],pass[18],sign=secure('\n');
int i=0,t=0,lenth=0;
rece:
printf("Please enter the path where you wanna to load:");
scanf("%s",p);
if(*p<'C'||*p>'F'||*(p+1)!=':'||*(p+2)!=92||strlen(p)>30||strlen(p)<4)
{
printf("Invalid input!\n");
goto rece;
}
if((fp=fopen(p,"rb"))==NULL)
{
printf("Error!");
return;
}
ant:
printf("Please input the password:");
scanf("%s",s);
lenth=strlen(s);
if(lenth>16||lenth<6)
{
printf("The password is obviously incorrect!\n");
goto ant;
}
while(*s!='')
{
temp=secure(*s);
s++;
i++;
}
temp='';
ch=fgetc(fp);
while(ch!=sign)
{
pass[t]=ch;
t++;
ch=fgetc(fp);
}
pass[t]='';
ch=desecure(ch);
if(!strcmp(temp,pass))
{
while(ch!='#')
{
ch=fgetc(fp);
ch=desecure(ch);
if(ch!='#')
putchar(ch);
}
}
else
printf("The password is incorrect!\n");
fclose(fp);
}
char secure(char c)
{
if(c+right>254)
return c-255+right;
else
return c+right;
}
char desecure(char c)
{
if(c<right)
return 255-right;
else
return c-right;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
加密其实就是通过一些特殊的手段或方式,使原本可以直观看到的东西增加了高级防护的措施。
例如一般的文件加密,通常是加了层密码保护。
密码加密,就是给原有密码增加一种转换模式,就有点像电报一样,经过固定的算法把原来的密码转化成其他的代码,即便给你看了你也不知道他原来是什么。
例如一般的文件加密,通常是加了层密码保护。
密码加密,就是给原有密码增加一种转换模式,就有点像电报一样,经过固定的算法把原来的密码转化成其他的代码,即便给你看了你也不知道他原来是什么。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询