- 浏览: 727351 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (419)
- 杂软粉墨 (2)
- 创意灵感 (3)
- 经验记录 (137)
- 开源轨迹 (2)
- sip-communicator (2)
- 闲侃杂谈 (8)
- 问题交流 (24)
- 概念模式 (32)
- 难点备案 (5)
- JwChat (1)
- 中国象棋 (1)
- 教育探索 (6)
- 英语研究 (58)
- 星际争霸 (1)
- 电信知识 (1)
- 软件架构 (3)
- 哲学探索 (26)
- 算法灵魂 (8)
- 近视探索 (6)
- 数学数学 (3)
- 牛角钻尖 (23)
- 至强文言 (3)
- 数据结构 (1)
- 宇宙物理 (2)
- 网络架构 (3)
- 游戏领域 (4)
- 图形处理 (2)
- 修炼之路 (8)
- 读书天地 (20)
- 编解乱码 (2)
- 概念探索 (8)
- 格物致知 (1)
- 其它语言 (1)
- 测试领域 (3)
- 文化风流 (1)
- JQuery (1)
- 網頁領域 (1)
- Unix/Linux (1)
- Inside JVM (1)
- 异常分析 (1)
最新评论
-
suyujie:
引用
HTML <a> 标签灰显禁用 -
suyujie:
HTML <a> 标签灰显禁用 -
suyujie:
HTML <a> 标签灰显禁用 -
suyujie:
HTML <a> 标签灰显禁用 -
iamzhoug37:
您能说一下"局部变量不受文本顺序限制" 是 ...
声明前为什么能赋值却不能输出,都是使用
A signature provides two security services, authentication and integrity. A signature gives you assurance that a message has not been tampered with and that it originated from a certain person. As you'll recall from Chapter 2, a signature is a message digest that is encrypted with the signer's private key. Only the signer's public key can decrypt the signature, which provides authentication. If the message digest of the message matches the decrypted message digest from the signature, then integrity is also assured.
Signatures do not provide confidentiality. A signature accompanies a plaintext message. Anyone can intercept and read the message. Signatures are useful for distributing software and documentation because they foil forgery.
http://oreilly.com/catalog/javacrypt/chapter/ch06.html
import java.security.InvalidKeyException; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.Signature; import java.security.SignatureException; public class Test { public static void main(String args[]) { try { // 1. Get the bytes in the Message. String strMessage = " Hello World !"; byte[] bMessage = strMessage.getBytes(); // 2. Get the PrivateKey and the PublicKey. KeyPair keyPair = KeyPairGenerator.getInstance("DSA") .generateKeyPair(); PrivateKey privateKey = keyPair.getPrivate(); PublicKey publicKey = keyPair.getPublic(); // Incorrect Public Key KeyPair keyPairIncorrect = KeyPairGenerator.getInstance("DSA") .generateKeyPair(); PublicKey publicKeyIncorrect = keyPairIncorrect.getPublic(); // 3. Encrypt the Data. Signature signature = Signature.getInstance("DSA"); signature.initSign(privateKey); signature.update(bMessage); // 4. Get the Signature, by signing the message. byte[] bSignature = signature.sign(); // 5. Decrypt the Signature with the Public Key and get the Message // Digest. Signature signaturePublic = Signature.getInstance("DSA"); // 6. Authentication signaturePublic.initVerify(publicKey); signaturePublic.update(bMessage); // 6. Check if the Signatures Match. boolean b = signaturePublic.verify(bSignature); if (b) { System.out.println(" The Signature is Good " + b); } else { System.out.println(" The Signature is Bad " + b); } } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (SignatureException e) { e.printStackTrace(); } catch (InvalidKeyException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } }
发表评论
-
关于方法访问控制符protected
2012-11-29 10:38 1196http://bbs.csdn.net/topics/3902 ... -
一个基本问题关于引用的
2012-05-15 10:20 1073问: int a = 1; Integer b = new ... -
我對面向對象和過程的理解。
2012-05-02 08:30 1005我的一些理解。 面向过程,是对客观现象的描述,感觉是有一个上 ... -
stack and heap
2012-01-13 23:17 1006我觉得是根据应用方式 和本身特性 才将内存分区的,目的是提 ... -
program experience conclusion
2011-07-11 15:35 10101. check parameters for validit ... -
PreparedStatement's possible designated parameter
2011-04-29 13:45 932though it's nearly impossible t ... -
clean Log4j
2011-04-12 11:19 1021import org.apache.log4j.BasicCo ... -
about abstract class
2011-04-02 10:34 803yes, we do know abstract class ... -
cvs operations on linux
2011-03-25 09:40 955http://www.linuxhowtos.org/Syst ... -
regex to exchange two parts
2011-03-24 17:09 1006public class Test { public ... -
About the database locking
2011-03-09 11:02 899http://en.wikipedia.org/wiki/Lo ... -
how to send soap message in java
2011-03-08 10:29 1850import java.io.BufferedReader; ... -
About ShutDownDemo
2011-03-07 15:02 917public class ShutdownDemo { p ... -
How do you know if an explicit object casting is needed
2011-02-24 16:33 1117通俗来讲,不可能将一只是猫的动物强转为狗 再说Graphic ... -
有关MimeUtility
2011-02-24 13:11 3292import java.io.UnsupportedEncod ... -
C#连接sql server 2008的一件2事
2011-02-24 09:01 2108once upon a time, i came upon o ... -
Shadowing, Overriding, Hiding and Obscuring
2011-02-22 15:15 1093当子类属性与父类属性重叠时 这种叫法上是shadowi ... -
JAXP usage
2011-02-16 16:07 1049import java.io.ByteArrayInputSt ... -
运行一个类,如果classpath中路径带空格就加双引号
2011-02-11 11:25 2760注意是这样加: java -cp .;"d:\my ... -
关于ClassPath中的current directory
2011-01-28 16:40 1112Given: 1. package com.company. ...
相关推荐
* an in-depth treatment of important recent cryptographic innovations, such as elliptic curves, elliptic curve and pairing-based cryptography, lattices, lattice-based cryptography, and the NTRU ...
cryptography cryptography cryptography cryptography cryptography cryptography cryptography cryptography cryptography cryptography cryptography
Real-World Cryptography
本书翻译原文来自美国PGP安全软件公司的产品PGP Desktop 9.9.0软件包中的Jon Callas在 2006年所著《An Introduction to Cryptography(Intro To Crypto.pdf(CRC-32:79EE7FEF))》,原文的意旨在于使所有普通人都可以...
Introduction to Modern Cryptography
Cryptography or cryptology is the practice and study of techniques for secure communication in the presence of third parties called adversaries. More generally, cryptography is about constructing and...
python27离线安装cryptography库资源
Public key cryptography is a major interdisciplinary subject with many real-world applications, such as digital signatures. A strong background in the mathematics underlying public key cryptography is...
PKCS #1: RSA Cryptography Specifications Version 2.2 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1. Requirements Language . . . . . . . . . . . . . . . . . ...
Beginning Cryptography with Java While cryptography can still be a controversial topic in the programming community, Java has weathered that storm and provides a rich set of APIs that allow you, the ...
Cryptography has crept into everything, from Web browsers and e-mail programs to cell phones, bank cards, cars and even into medical implants. In the near fu- ture we will see many new exciting ...
For one-semester, undergraduate- or graduate-level courses in Cryptography, Computer Security, and Network Security. The book is suitable for self-study and so provides a solid and up-to-date tutorial...
Practical Cryptography for Developers By 作者: Svetlin Nakov Pub Date: 2018 ISBN: 978-6190008705 Pages: 236 Language: English Format: EPUB Size: 10 Mb A modern practical book about cryptography for ...
Knowing what cryptographic designs are and how existing cryptographic protocols work does not give you proficiency in using cryptography. You must learn to think like a cryptographer. That is what ...
Throughout history, cryptography has been used to confidentially pass messages to different recipients. This has been especially useful in times of war. Up until World War II, with the use of the ...
Lecture Notes on Cryptography (麻省理工学院密码学讲义)
This is a graduate textbook of advanced tutorials on the theory of cryptography and computational complexity. In particular, the chapters explain aspects of garbled circuits, public-key cryptography, ...
cryptography-35.0.0-cp37-cp37m-win32.whl