Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
3d76802c
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3d76802c
编写于
8月 01, 2017
作者:
W
wetmore
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8169080: Improve documentation examples for crypto applications
Reviewed-by: mullan
上级
ceb5d25d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
44 addition
and
44 deletion
+44
-44
jdk/src/java.base/share/classes/java/security/MessageDigest.java
.../java.base/share/classes/java/security/MessageDigest.java
+2
-2
jdk/src/java.base/share/classes/java/security/Signature.java
jdk/src/java.base/share/classes/java/security/Signature.java
+4
-5
jdk/src/java.base/share/classes/java/security/SignedObject.java
...c/java.base/share/classes/java/security/SignedObject.java
+6
-7
jdk/src/java.base/share/classes/javax/crypto/Cipher.java
jdk/src/java.base/share/classes/javax/crypto/Cipher.java
+16
-14
jdk/src/java.base/share/classes/javax/crypto/CipherSpi.java
jdk/src/java.base/share/classes/javax/crypto/CipherSpi.java
+13
-13
jdk/src/java.base/share/classes/javax/crypto/Mac.java
jdk/src/java.base/share/classes/javax/crypto/Mac.java
+1
-1
jdk/src/java.base/share/classes/javax/crypto/SealedObject.java
...rc/java.base/share/classes/javax/crypto/SealedObject.java
+2
-2
未找到文件。
jdk/src/java.base/share/classes/java/security/MessageDigest.java
浏览文件 @
3d76802c
...
...
@@ -57,7 +57,7 @@ import javax.crypto.SecretKey;
* and catching the CloneNotSupportedException:
*
* <pre>{@code
* MessageDigest md = MessageDigest.getInstance("SHA");
* MessageDigest md = MessageDigest.getInstance("SHA
-256
");
*
* try {
* md.update(toChapter1);
...
...
@@ -496,7 +496,7 @@ public abstract class MessageDigest extends MessageDigestSpi {
/**
* Returns a string that identifies the algorithm, independent of
* implementation details. The name should be a standard
* Java Security name (such as "SHA
", "MD5", and so on
).
* Java Security name (such as "SHA
-256"
).
* See the MessageDigest section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms">
* Java Security Standard Algorithm Names Specification</a>
...
...
jdk/src/java.base/share/classes/java/security/Signature.java
浏览文件 @
3d76802c
...
...
@@ -51,11 +51,10 @@ import sun.security.jca.GetInstance.Instance;
* authentication and integrity assurance of digital data.
*
* <p> The signature algorithm can be, among others, the NIST standard
* DSA, using DSA and SHA-1. The DSA algorithm using the
* SHA-1 message digest algorithm can be specified as {@code SHA1withDSA}.
* In the case of RSA, there are multiple choices for the message digest
* algorithm, so the signing algorithm could be specified as, for example,
* {@code MD2withRSA}, {@code MD5withRSA}, or {@code SHA1withRSA}.
* DSA, using DSA and SHA-256. The DSA algorithm using the
* SHA-256 message digest algorithm can be specified as {@code SHA256withDSA}.
* In the case of RSA the signing algorithm could be specified as, for example,
* {@code SHA256withRSA}.
* The algorithm name must be specified, as there is no default.
*
* <p> A Signature object can be used to generate and verify digital
...
...
jdk/src/java.base/share/classes/java/security/SignedObject.java
浏览文件 @
3d76802c
/*
* Copyright (c) 1997, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -81,13 +81,12 @@ import java.io.*;
* verification in an attempt to bypass a security check.
*
* <p> The signature algorithm can be, among others, the NIST standard
* DSA, using DSA and SHA-
1
. The algorithm is specified using the
* DSA, using DSA and SHA-
256
. The algorithm is specified using the
* same convention as that for signatures. The DSA algorithm using the
* SHA-1 message digest algorithm can be specified, for example, as
* "SHA/DSA" or "SHA-1/DSA" (they are equivalent). In the case of
* RSA, there are multiple choices for the message digest algorithm,
* so the signing algorithm could be specified as, for example,
* "MD2/RSA", "MD5/RSA" or "SHA-1/RSA". The algorithm name must be
* SHA-256 message digest algorithm can be specified, for example, as
* "SHA256withDSA". In the case of
* RSA the signing algorithm could be specified as, for example,
* "SHA256withRSA". The algorithm name must be
* specified, as there is no default.
*
* <p> The name of the Cryptography Package Provider is designated
...
...
jdk/src/java.base/share/classes/javax/crypto/Cipher.java
浏览文件 @
3d76802c
...
...
@@ -59,7 +59,7 @@ import sun.security.jca.*;
* <p>A <i>transformation</i> is a string that describes the operation (or
* set of operations) to be performed on the given input, to produce some
* output. A transformation always includes the name of a cryptographic
* algorithm (e.g., <i>
D
ES</i>), and may be followed by a feedback mode and
* algorithm (e.g., <i>
A
ES</i>), and may be followed by a feedback mode and
* padding scheme.
*
* <p> A transformation is of the form:
...
...
@@ -75,17 +75,19 @@ import sun.security.jca.*;
* For example, the following is a valid transformation:
*
* <pre>
* Cipher c = Cipher.getInstance("<i>
D
ES/CBC/PKCS5Padding</i>");
* Cipher c = Cipher.getInstance("<i>
A
ES/CBC/PKCS5Padding</i>");
* </pre>
*
* Using modes such as {@code CFB} and {@code OFB}, block
* ciphers can encrypt data in units smaller than the cipher's actual
* block size. When requesting such a mode, you may optionally specify
* the number of bits to be processed at a time by appending this number
* to the mode name as shown in the "{@code DES/CFB8/NoPadding}" and
* "{@code DES/OFB32/PKCS5Padding}" transformations. If no such
* number is specified, a provider-specific default is used. (For
* example, the SunJCE provider uses a default of 64 bits for DES.)
* to the mode name as shown in the "{@code AES/CFB8/NoPadding}" and
* "{@code AES/OFB32/PKCS5Padding}" transformations. If no such
* number is specified, a provider-specific default is used.
* (See the
* {@extLink security_guide_jdk_providers JDK Providers Documentation}
* for the JDK Providers default values.)
* Thus, block ciphers can be turned into byte-oriented stream ciphers by
* using an 8 bit mode such as CFB8 or OFB8.
* <p>
...
...
@@ -308,7 +310,7 @@ public class Cipher {
/*
* array containing the components of a Cipher transformation:
*
* index 0: algorithm component (e.g.,
D
ES)
* index 0: algorithm component (e.g.,
A
ES)
* index 1: feedback component (e.g., CFB)
* index 2: padding component (e.g., PKCS5Padding)
*/
...
...
@@ -354,8 +356,8 @@ public class Cipher {
// transform string to lookup in the provider
final
String
transform
;
// the mode/padding suffix in upper case. for example, if the algorithm
// to lookup is "
D
ES/CBC/PKCS5Padding" suffix is "/CBC/PKCS5PADDING"
// if loo
pup is "D
ES", suffix is the empty string
// to lookup is "
A
ES/CBC/PKCS5Padding" suffix is "/CBC/PKCS5PADDING"
// if loo
kup is "A
ES", suffix is the empty string
// needed because aliases prevent straight transform.equals()
final
String
suffix
;
// value to pass to setMode() or null if no such call required
...
...
@@ -440,11 +442,11 @@ public class Cipher {
}
if
((
mode
==
null
)
&&
(
pad
==
null
))
{
//
D
ES
//
A
ES
Transform
tr
=
new
Transform
(
alg
,
""
,
null
,
null
);
return
Collections
.
singletonList
(
tr
);
}
else
{
// if ((mode != null) && (pad != null)) {
//
D
ES/CBC/PKCS5Padding
//
A
ES/CBC/PKCS5Padding
List
<
Transform
>
list
=
new
ArrayList
<>(
4
);
list
.
add
(
new
Transform
(
alg
,
"/"
+
mode
+
"/"
+
pad
,
null
,
null
));
list
.
add
(
new
Transform
(
alg
,
"/"
+
mode
,
null
,
pad
));
...
...
@@ -488,7 +490,7 @@ public class Cipher {
* {@link Security#getProviders() Security.getProviders()}.
*
* @param transformation the name of the transformation, e.g.,
* <i>
D
ES/CBC/PKCS5Padding</i>.
* <i>
A
ES/CBC/PKCS5Padding</i>.
* See the Cipher section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names">
* Java Security Standard Algorithm Names Specification</a>
...
...
@@ -566,7 +568,7 @@ public class Cipher {
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @param transformation the name of the transformation,
* e.g., <i>
D
ES/CBC/PKCS5Padding</i>.
* e.g., <i>
A
ES/CBC/PKCS5Padding</i>.
* See the Cipher section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names">
* Java Security Standard Algorithm Names Specification</a>
...
...
@@ -626,7 +628,7 @@ public class Cipher {
* does not have to be registered in the provider list.
*
* @param transformation the name of the transformation,
* e.g., <i>
D
ES/CBC/PKCS5Padding</i>.
* e.g., <i>
A
ES/CBC/PKCS5Padding</i>.
* See the Cipher section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names">
* Java Security Standard Algorithm Names Specification</a>
...
...
jdk/src/java.base/share/classes/javax/crypto/CipherSpi.java
浏览文件 @
3d76802c
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -59,7 +59,7 @@ import java.nio.ByteBuffer;
* <p>A <i>transformation</i> is a string that describes the operation (or
* set of operations) to be performed on the given input, to produce some
* output. A transformation always includes the name of a cryptographic
* algorithm (e.g., <i>
D
ES</i>), and may be followed by a feedback mode and
* algorithm (e.g., <i>
A
ES</i>), and may be followed by a feedback mode and
* padding scheme.
*
* <p> A transformation is of the form:
...
...
@@ -75,7 +75,7 @@ import java.nio.ByteBuffer;
* For example, the following is a valid transformation:
*
* <pre>
* Cipher c = Cipher.getInstance("<i>
D
ES/CBC/PKCS5Padding</i>");
* Cipher c = Cipher.getInstance("<i>
A
ES/CBC/PKCS5Padding</i>");
* </pre>
*
* <p>A provider may supply a separate class for each combination
...
...
@@ -125,32 +125,32 @@ import java.nio.ByteBuffer;
* </ul>
*
* <p>For example, a provider may supply a subclass of <code>CipherSpi</code>
* that implements <i>
D
ES/ECB/PKCS5Padding</i>, one that implements
* <i>
D
ES/CBC/PKCS5Padding</i>, one that implements
* <i>
D
ES/CFB/PKCS5Padding</i>, and yet another one that implements
* <i>
D
ES/OFB/PKCS5Padding</i>. That provider would have the following
* that implements <i>
A
ES/ECB/PKCS5Padding</i>, one that implements
* <i>
A
ES/CBC/PKCS5Padding</i>, one that implements
* <i>
A
ES/CFB/PKCS5Padding</i>, and yet another one that implements
* <i>
A
ES/OFB/PKCS5Padding</i>. That provider would have the following
* <code>Cipher</code> properties in its master class:
*
* <ul>
*
* <li>
* <pre>
* <code>Cipher.</code><i>
D
ES/ECB/PKCS5Padding</i>
* <code>Cipher.</code><i>
A
ES/ECB/PKCS5Padding</i>
* </pre>
*
* <li>
* <pre>
* <code>Cipher.</code><i>
D
ES/CBC/PKCS5Padding</i>
* <code>Cipher.</code><i>
A
ES/CBC/PKCS5Padding</i>
* </pre>
*
* <li>
* <pre>
* <code>Cipher.</code><i>
D
ES/CFB/PKCS5Padding</i>
* <code>Cipher.</code><i>
A
ES/CFB/PKCS5Padding</i>
* </pre>
*
* <li>
* <pre>
* <code>Cipher.</code><i>
D
ES/OFB/PKCS5Padding</i>
* <code>Cipher.</code><i>
A
ES/OFB/PKCS5Padding</i>
* </pre>
*
* </ul>
...
...
@@ -158,7 +158,7 @@ import java.nio.ByteBuffer;
* <p>Another provider may implement a class for each of the above modes
* (i.e., one class for <i>ECB</i>, one for <i>CBC</i>, one for <i>CFB</i>,
* and one for <i>OFB</i>), one class for <i>PKCS5Padding</i>,
* and a generic <i>
D
ES</i> class that subclasses from <code>CipherSpi</code>.
* and a generic <i>
A
ES</i> class that subclasses from <code>CipherSpi</code>.
* That provider would have the following
* <code>Cipher</code> properties in its master class:
*
...
...
@@ -166,7 +166,7 @@ import java.nio.ByteBuffer;
*
* <li>
* <pre>
* <code>Cipher.</code><i>
D
ES</i>
* <code>Cipher.</code><i>
A
ES</i>
* </pre>
*
* </ul>
...
...
jdk/src/java.base/share/classes/javax/crypto/Mac.java
浏览文件 @
3d76802c
...
...
@@ -50,7 +50,7 @@ import sun.security.jca.GetInstance.Instance;
*
* <p> A MAC mechanism that is based on cryptographic hash functions is
* referred to as HMAC. HMAC can be used with any cryptographic hash function,
* e.g.,
MD5 or SHA-1
, in combination with a secret shared key. HMAC is
* e.g.,
SHA256 or SHA384
, in combination with a secret shared key. HMAC is
* specified in RFC 2104.
*
* <p> Every implementation of the Java platform is required to support
...
...
jdk/src/java.base/share/classes/javax/crypto/SealedObject.java
浏览文件 @
3d76802c
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -40,7 +40,7 @@ import java.security.NoSuchProviderException;
* <p> Given any Serializable object, one can create a SealedObject
* that encapsulates the original object, in serialized
* format (i.e., a "deep copy"), and seals (encrypts) its serialized contents,
* using a cryptographic algorithm such as
D
ES, to protect its
* using a cryptographic algorithm such as
A
ES, to protect its
* confidentiality. The encrypted content can later be decrypted (with
* the corresponding algorithm using the correct decryption key) and
* de-serialized, yielding the original object.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录