资源简介
RSA加密及解密的MATLAB源程序
有需要的,可以下
代码片段和文件信息
function outp = rsadec(inpkey)
% RSADEC - rapidly decrypt a short message using RSA
%
% pt=rsadec(ctkey)
%
% ct = cyphertext (uint8 vector) created by RSAENC
% key = private or public key created by the RSAKEYS function
% pt = plaintext message (a vector of type uint8) which you may
% wish to convert to text using “char(pt)“
%
% Notes: (1) This function uses Java which contains the calculation
% routines
% (2) The usual use of RSA is for encryption of keys in a “key
% exchange“ so the plaintext size limits provided by the Java
% routines (which are adequate for that purpose) have not been
% expanded here. (For example a 128-bit AES encryption key
% requires only 16 bytes.) See the RSAENC function.
% (3) An RSA “key“ consists of two quatities: a modulus and an
% exponent. RSA keys always come in pairs with one key denoted
% “public“ and the other as “private.“ A message that is
% encrypted using EITHER key must be decrypted using the OTHER
% key. You keep the private key secret and broadcast the public
% key. Anyone can then encrypt any message to you using the
% public key but no one but you can decrypt it (not even the
% sender) since only you have the secret key. Also you can
% encrypt a message using your private key and anyone can
% decrypt it using the public key. The benefit is that they then
% know for sure that you are the person who generated the
% message.
% (4) RSA modulus and exponent selection have certain nuances
% beyond the basic numerical calculations. In particular
% certain values for various components of the key generation
% can result in encryption weaknesses. For this reason you
% may choose to avoid generating RSA key pairs yourself and
% instead rely upon “official“ key generation code such as the
% Java routines used in this function.
% (5) As of 2005 “RSA Laboratories currently recommends key
% sizes of 1024 bits for corporate use and 2048 bits for
% extremely valuable keys....“ For more information see
% http://www.rsasecurity.com/rsalabs/node.asp?id=2218
% (6) As of 2005 the US National Institue of Standards and
% Technology claims that 2048 bit keys for RSA will remain
% resistant to cracking until about 2030.
% (7) Tested but no warranty; use at your own risk.
% (8) Michael Kleder Nov 2005
%
% EXAMPLE:
%
% [pripub]=rsakeys(1024);
% char(rsadec(rsaenc(‘This is a secret.‘pub)pri))
% char(rsadec(rsaenc(‘This is a secret.‘pri)pub))
if ischar(inp) | islogical(inp)
inp=uint8(inp(:));
else
inp=typecast(inp(:)‘uint8‘);
end
modulus = java.math.BigInteger(key.modulus);
pubexp = java.math.BigI
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3442 2005-11-19 01:04 rsadec.m
文件 3545 2005-11-19 01:04 rsaenc.m
相关资源
- 一种基于QR分解的图像脆弱水印算法实
- 基于Matlab实现的DES加密
- 弹性光网络中的KSP-FF-RSA算法Matlab代码
- 混沌加密的MATLAB实现
- MATLAB图像加密解密GUI.zip
- 仿射变换加密Matlab程序源代码(凯撒
- radarsat-1 RD成像算法
- matlab 实现的RSA加解密算法
- 基于logistic混沌序列的图像加密彩色图
- MATLAB logistic实现图像扩散
- MATLAB 实现转轮机加密与解密
- 运用Arnold与Logistic的简单图像加密程序
- matlab开发-图片加密和解密
- matlab使用混沌序列进行图像加密
- matlab-logistic图像加密解密-彩色-灰度都
- RSA加密算法的Matlab程序
- SAR原始数据成像算法_RD,CS算法
- 用MATLAB编写的混沌序列图像加密程序
- 基于MATLAB实现的采用混沌和小波相结
- 任意尺寸彩色图像加密与解密
- matlab基于混沌映射对图像加密和解密
- AES加密算法的matlab
- matlab图像加密npcr值计算
- 一个二维logistics函数实现的图像加密
- MATLAB实现的AES加密和解密算法
- 高鲁棒性的自适应图像加密算法
- frft 离散分数傅里叶
- Radarsat2 将Radarsat2极化SAR图像数据转换
- arnold-logistic
- MATLAB-PROGRAM-FOR-ECC
评论
共有 条评论