Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
a462b5ee
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,发现更多精彩内容 >>
提交
a462b5ee
编写于
10月 21, 2009
作者:
C
chegar
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
0ae59891
aa9d763f
变更
31
展开全部
隐藏空白更改
内联
并排
Showing
31 changed file
with
4377 addition
and
862 deletion
+4377
-862
jdk/make/sun/net/FILES_java.gmk
jdk/make/sun/net/FILES_java.gmk
+6
-0
jdk/src/share/classes/java/math/BigInteger.java
jdk/src/share/classes/java/math/BigInteger.java
+18
-4
jdk/src/share/classes/java/net/CookieHandler.java
jdk/src/share/classes/java/net/CookieHandler.java
+13
-3
jdk/src/share/classes/java/net/CookieManager.java
jdk/src/share/classes/java/net/CookieManager.java
+7
-0
jdk/src/share/classes/java/util/jar/JarFile.java
jdk/src/share/classes/java/util/jar/JarFile.java
+2
-1
jdk/src/share/classes/java/util/jar/JarVerifier.java
jdk/src/share/classes/java/util/jar/JarVerifier.java
+4
-4
jdk/src/share/classes/sun/net/ftp/FtpClient.java
jdk/src/share/classes/sun/net/ftp/FtpClient.java
+774
-646
jdk/src/share/classes/sun/net/ftp/FtpClientProvider.java
jdk/src/share/classes/sun/net/ftp/FtpClientProvider.java
+158
-0
jdk/src/share/classes/sun/net/ftp/FtpDirEntry.java
jdk/src/share/classes/sun/net/ftp/FtpDirEntry.java
+331
-0
jdk/src/share/classes/sun/net/ftp/FtpDirParser.java
jdk/src/share/classes/sun/net/ftp/FtpDirParser.java
+49
-0
jdk/src/share/classes/sun/net/ftp/FtpLoginException.java
jdk/src/share/classes/sun/net/ftp/FtpLoginException.java
+4
-4
jdk/src/share/classes/sun/net/ftp/FtpProtocolException.java
jdk/src/share/classes/sun/net/ftp/FtpProtocolException.java
+38
-10
jdk/src/share/classes/sun/net/ftp/FtpReplyCode.java
jdk/src/share/classes/sun/net/ftp/FtpReplyCode.java
+248
-0
jdk/src/share/classes/sun/net/ftp/impl/DefaultFtpClientProvider.java
...re/classes/sun/net/ftp/impl/DefaultFtpClientProvider.java
+38
-0
jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java
jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java
+2191
-0
jdk/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
...re/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
+183
-136
jdk/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java
...asses/sun/net/www/protocol/http/DigestAuthentication.java
+4
-2
jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
.../classes/sun/net/www/protocol/http/HttpURLConnection.java
+4
-8
jdk/src/share/classes/sun/security/jca/Providers.java
jdk/src/share/classes/sun/security/jca/Providers.java
+4
-1
jdk/src/share/classes/sun/security/pkcs/SignerInfo.java
jdk/src/share/classes/sun/security/pkcs/SignerInfo.java
+7
-6
jdk/src/share/classes/sun/security/tools/JarSigner.java
jdk/src/share/classes/sun/security/tools/JarSigner.java
+15
-13
jdk/src/share/classes/sun/security/tools/KeyTool.java
jdk/src/share/classes/sun/security/tools/KeyTool.java
+1
-1
jdk/src/share/classes/sun/security/tools/TimestampedSigner.java
...c/share/classes/sun/security/tools/TimestampedSigner.java
+5
-13
jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java
...hare/classes/sun/security/util/SignatureFileVerifier.java
+6
-5
jdk/src/share/classes/sun/security/x509/AlgorithmId.java
jdk/src/share/classes/sun/security/x509/AlgorithmId.java
+49
-0
jdk/src/share/classes/sun/tools/jar/SignatureFile.java
jdk/src/share/classes/sun/tools/jar/SignatureFile.java
+5
-3
jdk/test/com/sun/jdi/ShellScaffold.sh
jdk/test/com/sun/jdi/ShellScaffold.sh
+1
-1
jdk/test/java/math/BigInteger/ExtremeShiftingTests.java
jdk/test/java/math/BigInteger/ExtremeShiftingTests.java
+48
-0
jdk/test/java/net/CookieHandler/B6644726.java
jdk/test/java/net/CookieHandler/B6644726.java
+23
-1
jdk/test/sun/net/www/protocol/http/B6890349.java
jdk/test/sun/net/www/protocol/http/B6890349.java
+68
-0
jdk/test/sun/security/tools/jarsigner/ec.sh
jdk/test/sun/security/tools/jarsigner/ec.sh
+73
-0
未找到文件。
jdk/make/sun/net/FILES_java.gmk
浏览文件 @
a462b5ee
...
...
@@ -45,8 +45,14 @@ FILES_java = \
sun/net/dns/ResolverConfiguration.java \
sun/net/dns/ResolverConfigurationImpl.java \
sun/net/ftp/FtpClient.java \
sun/net/ftp/FtpClientProvider.java \
sun/net/ftp/FtpDirEntry.java \
sun/net/ftp/FtpReplyCode.java \
sun/net/ftp/FtpDirParser.java \
sun/net/ftp/FtpLoginException.java \
sun/net/ftp/FtpProtocolException.java \
sun/net/ftp/impl/FtpClient.java \
sun/net/ftp/impl/DefaultFtpClientProvider.java \
sun/net/spi/DefaultProxySelector.java \
sun/net/spi/nameservice/NameServiceDescriptor.java \
sun/net/spi/nameservice/NameService.java \
...
...
jdk/src/share/classes/java/math/BigInteger.java
浏览文件 @
a462b5ee
...
...
@@ -2051,6 +2051,8 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*
* @param n shift distance, in bits.
* @return {@code this << n}
* @throws ArithmeticException if the shift distance is {@code
* Integer.MIN_VALUE}.
* @see #shiftRight
*/
public
BigInteger
shiftLeft
(
int
n
)
{
...
...
@@ -2058,8 +2060,13 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
return
ZERO
;
if
(
n
==
0
)
return
this
;
if
(
n
<
0
)
return
shiftRight
(-
n
);
if
(
n
<
0
)
{
if
(
n
==
Integer
.
MIN_VALUE
)
{
throw
new
ArithmeticException
(
"Shift distance of Integer.MIN_VALUE not supported."
);
}
else
{
return
shiftRight
(-
n
);
}
}
int
nInts
=
n
>>>
5
;
int
nBits
=
n
&
0x1f
;
...
...
@@ -2097,13 +2104,20 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*
* @param n shift distance, in bits.
* @return {@code this >> n}
* @throws ArithmeticException if the shift distance is {@code
* Integer.MIN_VALUE}.
* @see #shiftLeft
*/
public
BigInteger
shiftRight
(
int
n
)
{
if
(
n
==
0
)
return
this
;
if
(
n
<
0
)
return
shiftLeft
(-
n
);
if
(
n
<
0
)
{
if
(
n
==
Integer
.
MIN_VALUE
)
{
throw
new
ArithmeticException
(
"Shift distance of Integer.MIN_VALUE not supported."
);
}
else
{
return
shiftLeft
(-
n
);
}
}
int
nInts
=
n
>>>
5
;
int
nBits
=
n
&
0x1f
;
...
...
jdk/src/share/classes/java/net/CookieHandler.java
浏览文件 @
a462b5ee
...
...
@@ -101,11 +101,21 @@ public abstract class CookieHandler {
* Gets all the applicable cookies from a cookie cache for the
* specified uri in the request header.
*
* HTTP protocol implementers should make sure that this method is
* <P>The {@code URI} passed as an argument specifies the intended use for
* the cookies. In particular the scheme should reflect whether the cookies
* will be sent over http, https or used in another context like javascript.
* The host part should reflect either the destination of the cookies or
* their origin in the case of javascript.</P>
* <P>It is up to the implementation to take into account the {@code URI} and
* the cookies attributes and security settings to determine which ones
* should be returned.</P>
*
* <P>HTTP protocol implementers should make sure that this method is
* called after all request headers related to choosing cookies
* are added, and before the request is sent.
* are added, and before the request is sent.
</P>
*
* @param uri a <code>URI</code> to send cookies to in a request
* @param uri a <code>URI</code> representing the intended use for the
* cookies
* @param requestHeaders - a Map from request header
* field names to lists of field values representing
* the current request headers
...
...
jdk/src/share/classes/java/net/CookieManager.java
浏览文件 @
a462b5ee
...
...
@@ -218,6 +218,13 @@ public class CookieManager extends CookieHandler
// 'secure' cookies over unsecure links)
if
(
pathMatches
(
path
,
cookie
.
getPath
())
&&
(
secureLink
||
!
cookie
.
getSecure
()))
{
// Enforce httponly attribute
if
(
cookie
.
isHttpOnly
())
{
String
s
=
uri
.
getScheme
();
if
(!
"http"
.
equalsIgnoreCase
(
s
)
&&
!
"https"
.
equalsIgnoreCase
(
s
))
{
continue
;
}
}
// Let's check the authorize port list if it exists
String
ports
=
cookie
.
getPortlist
();
if
(
ports
!=
null
&&
!
ports
.
isEmpty
())
{
...
...
jdk/src/share/classes/java/util/jar/JarFile.java
浏览文件 @
a462b5ee
/*
* Copyright 1997-200
6
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-200
9
Sun Microsystems, Inc. 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
...
...
@@ -297,6 +297,7 @@ class JarFile extends ZipFile {
String
name
=
names
[
i
].
toUpperCase
(
Locale
.
ENGLISH
);
if
(
name
.
endsWith
(
".DSA"
)
||
name
.
endsWith
(
".RSA"
)
||
name
.
endsWith
(
".EC"
)
||
name
.
endsWith
(
".SF"
))
{
// Assume since we found a signature-related file
// that the jar is signed and that we therefore
...
...
jdk/src/share/classes/java/util/jar/JarVerifier.java
浏览文件 @
a462b5ee
/*
* Copyright 1997-200
5
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-200
9
Sun Microsystems, Inc. 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
...
...
@@ -50,7 +50,7 @@ class JarVerifier {
private
Hashtable
verifiedSigners
;
/* a table mapping names to code signers, for jar entries that have
passed the .SF/.DSA -> MANIFEST check */
passed the .SF/.DSA
/.EC
-> MANIFEST check */
private
Hashtable
sigFileSigners
;
/* a hash table to hold .SF bytes */
...
...
@@ -111,7 +111,7 @@ class JarVerifier {
/*
* Assumptions:
* 1. The manifest should be the first entry in the META-INF directory.
* 2. The .SF/.DSA files follow the manifest, before any normal entries
* 2. The .SF/.DSA
/.EC
files follow the manifest, before any normal entries
* 3. Any of the following will throw a SecurityException:
* a. digest mismatch between a manifest section and
* the SF section.
...
...
@@ -129,7 +129,7 @@ class JarVerifier {
}
if
(
SignatureFileVerifier
.
isBlockOrSF
(
uname
))
{
/* We parse only DSA
or RSA
PKCS7 blocks. */
/* We parse only DSA
, RSA or EC
PKCS7 blocks. */
parsingBlockOrSF
=
true
;
baos
.
reset
();
mev
.
setEntry
(
null
,
je
);
...
...
jdk/src/share/classes/sun/net/ftp/FtpClient.java
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/src/share/classes/sun/net/ftp/FtpClientProvider.java
0 → 100644
浏览文件 @
a462b5ee
/*
* Copyright 2009 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
sun.net.ftp
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.util.ServiceConfigurationError
;
//import sun.misc.Service;
/**
* Service provider class for FtpClient.
* Sub-classes of FtpClientProvider provide an implementation of {@link FtpClient}
* and associated classes. Applications do not normally use this class directly.
* See {@link #provider() } for how providers are found and loaded.
*
* @since 1.7
*/
public
abstract
class
FtpClientProvider
{
/**
* Creates a FtpClient from this provider.
*
* @return The created {@link FtpClient}.
*/
public
abstract
FtpClient
createFtpClient
();
private
static
final
Object
lock
=
new
Object
();
private
static
FtpClientProvider
provider
=
null
;
/**
* Initializes a new instance of this class.
*
* @throws SecurityException if a security manager is installed and it denies
* {@link RuntimePermission}<tt>("ftpClientProvider")</tt>
*/
protected
FtpClientProvider
()
{
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
sm
!=
null
)
{
sm
.
checkPermission
(
new
RuntimePermission
(
"ftpClientProvider"
));
}
}
private
static
boolean
loadProviderFromProperty
()
{
String
cm
=
System
.
getProperty
(
"sun.net.ftpClientProvider"
);
if
(
cm
==
null
)
{
return
false
;
}
try
{
Class
c
=
Class
.
forName
(
cm
,
true
,
null
);
provider
=
(
FtpClientProvider
)
c
.
newInstance
();
return
true
;
}
catch
(
ClassNotFoundException
x
)
{
throw
new
ServiceConfigurationError
(
x
.
toString
());
}
catch
(
IllegalAccessException
x
)
{
throw
new
ServiceConfigurationError
(
x
.
toString
());
}
catch
(
InstantiationException
x
)
{
throw
new
ServiceConfigurationError
(
x
.
toString
());
}
catch
(
SecurityException
x
)
{
throw
new
ServiceConfigurationError
(
x
.
toString
());
}
}
private
static
boolean
loadProviderAsService
()
{
// Iterator i = Service.providers(FtpClientProvider.class,
// ClassLoader.getSystemClassLoader());
// while (i.hasNext()) {
// try {
// provider = (FtpClientProvider) i.next();
// return true;
// } catch (ServiceConfigurationError sce) {
// if (sce.getCause() instanceof SecurityException) {
// // Ignore, try next provider, if any
// continue;
// }
// throw sce;
// }
// }
return
false
;
}
/**
* Returns the system wide default FtpClientProvider for this invocation of
* the Java virtual machine.
*
* <p> The first invocation of this method locates the default provider
* object as follows: </p>
*
* <ol>
*
* <li><p> If the system property
* <tt>java.net.FtpClientProvider</tt> is defined then it is
* taken to be the fully-qualified name of a concrete provider class.
* The class is loaded and instantiated; if this process fails then an
* unspecified unchecked error or exception is thrown. </p></li>
*
* <li><p> If a provider class has been installed in a jar file that is
* visible to the system class loader, and that jar file contains a
* provider-configuration file named
* <tt>java.net.FtpClientProvider</tt> in the resource
* directory <tt>META-INF/services</tt>, then the first class name
* specified in that file is taken. The class is loaded and
* instantiated; if this process fails then an unspecified unchecked error or exception is
* thrown. </p></li>
*
* <li><p> Finally, if no provider has been specified by any of the above
* means then the system-default provider class is instantiated and the
* result is returned. </p></li>
*
* </ol>
*
* <p> Subsequent invocations of this method return the provider that was
* returned by the first invocation. </p>
*
* @return The system-wide default FtpClientProvider
*/
public
static
FtpClientProvider
provider
()
{
synchronized
(
lock
)
{
if
(
provider
!=
null
)
{
return
provider
;
}
return
(
FtpClientProvider
)
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Object
>()
{
public
Object
run
()
{
if
(
loadProviderFromProperty
())
{
return
provider
;
}
if
(
loadProviderAsService
())
{
return
provider
;
}
provider
=
new
sun
.
net
.
ftp
.
impl
.
DefaultFtpClientProvider
();
return
provider
;
}
});
}
}
}
jdk/src/share/classes/sun/net/ftp/FtpDirEntry.java
0 → 100644
浏览文件 @
a462b5ee
/*
* Copyright 2009 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
sun.net.ftp
;
import
java.util.Date
;
import
java.util.HashMap
;
/**
* A {@code FtpDirEntry} is a class agregating all the information that the FTP client
* can gather from the server by doing a {@code LST} (or {@code NLST}) command and
* parsing the output. It will typically contain the name, type, size, last modification
* time, owner and group of the file, although some of these could be unavailable
* due to specific FTP server limitations.
*
* @see sun.net.ftp.FtpDirParser
* @since 1.7
*/
public
class
FtpDirEntry
{
public
enum
Type
{
FILE
,
DIR
,
PDIR
,
CDIR
,
LINK
};
public
enum
Permission
{
USER
(
0
),
GROUP
(
1
),
OTHERS
(
2
);
int
value
;
Permission
(
int
v
)
{
value
=
v
;
}
};
private
final
String
name
;
private
String
user
=
null
;
private
String
group
=
null
;
private
long
size
=
-
1
;
private
java
.
util
.
Date
created
=
null
;
private
java
.
util
.
Date
lastModified
=
null
;
private
Type
type
=
Type
.
FILE
;
private
boolean
[][]
permissions
=
null
;
private
HashMap
<
String
,
String
>
facts
=
new
HashMap
<
String
,
String
>();
private
FtpDirEntry
()
{
name
=
null
;
}
/**
* Creates an FtpDirEntry instance with only the name being set.
*
* @param name The name of the file
*/
public
FtpDirEntry
(
String
name
)
{
this
.
name
=
name
;
}
/**
* Returns the name of the remote file.
*
* @return a {@code String} containing the name of the remote file.
*/
public
String
getName
()
{
return
name
;
}
/**
* Returns the user name of the owner of the file as returned by the FTP
* server, if provided. This could be a name or a user id (number).
*
* @return a {@code String} containing the user name or
* {@code null} if that information is not available.
*/
public
String
getUser
()
{
return
user
;
}
/**
* Sets the user name of the owner of the file. Intended mostly to be
* used from inside a {@link java.net.FtpDirParser} implementation.
*
* @param user The user name of the owner of the file, or {@code null}
* if that information is not available.
* @return this FtpDirEntry
*/
public
FtpDirEntry
setUser
(
String
user
)
{
this
.
user
=
user
;
return
this
;
}
/**
* Returns the group name of the file as returned by the FTP
* server, if provided. This could be a name or a group id (number).
*
* @return a {@code String} containing the group name or
* {@code null} if that information is not available.
*/
public
String
getGroup
()
{
return
group
;
}
/**
* Sets the name of the group to which the file belong. Intended mostly to be
* used from inside a {@link java.net.FtpDirParser} implementation.
*
* @param group The name of the group to which the file belong, or {@code null}
* if that information is not available.
* @return this FtpDirEntry
*/
public
FtpDirEntry
setGroup
(
String
group
)
{
this
.
group
=
group
;
return
this
;
}
/**
* Returns the size of the remote file as it was returned by the FTP
* server, if provided.
*
* @return the size of the file or -1 if that information is not available.
*/
public
long
getSize
()
{
return
size
;
}
/**
* Sets the size of that file. Intended mostly to be used from inside an
* {@link java.net.FtpDirParser} implementation.
*
* @param size The size, in bytes, of that file. or -1 if unknown.
* @return this FtpDirEntry
*/
public
FtpDirEntry
setSize
(
long
size
)
{
this
.
size
=
size
;
return
this
;
}
/**
* Returns the type of the remote file as it was returned by the FTP
* server, if provided.
* It returns a FtpDirEntry.Type enum and the values can be:
* - FtpDirEntry.Type.FILE for a normal file
* - FtpDirEntry.Type.DIR for a directory
* - FtpDirEntry.Type.LINK for a symbolic link
*
* @return a {@code FtpDirEntry.Type} describing the type of the file
* or {@code null} if that information is not available.
*/
public
Type
getType
()
{
return
type
;
}
/**
* Sets the type of the file. Intended mostly to be used from inside an
* {@link java.net.FtpDirParser} implementation.
*
* @param type the type of this file or {@code null} if that information
* is not available.
* @return this FtpDirEntry
*/
public
FtpDirEntry
setType
(
Type
type
)
{
this
.
type
=
type
;
return
this
;
}
/**
* Returns the last modification time of the remote file as it was returned
* by the FTP server, if provided, {@code null} otherwise.
*
* @return a <code>Date</code> representing the last time the file was
* modified on the server, or {@code null} if that
* information is not available.
*/
public
java
.
util
.
Date
getLastModified
()
{
return
this
.
lastModified
;
}
/**
* Sets the last modification time of the file. Intended mostly to be used
* from inside an {@link java.net.FtpDirParser} implementation.
*
* @param lastModified The Date representing the last modification time, or
* {@code null} if that information is not available.
* @return this FtpDirEntry
*/
public
FtpDirEntry
setLastModified
(
Date
lastModified
)
{
this
.
lastModified
=
lastModified
;
return
this
;
}
/**
* Returns whether read access is granted for a specific permission.
*
* @param p the Permission (user, group, others) to check.
* @return {@code true} if read access is granted.
*/
public
boolean
canRead
(
Permission
p
)
{
if
(
permissions
!=
null
)
{
return
permissions
[
p
.
value
][
0
];
}
return
false
;
}
/**
* Returns whether write access is granted for a specific permission.
*
* @param p the Permission (user, group, others) to check.
* @return {@code true} if write access is granted.
*/
public
boolean
canWrite
(
Permission
p
)
{
if
(
permissions
!=
null
)
{
return
permissions
[
p
.
value
][
1
];
}
return
false
;
}
/**
* Returns whether execute access is granted for a specific permission.
*
* @param p the Permission (user, group, others) to check.
* @return {@code true} if execute access is granted.
*/
public
boolean
canExexcute
(
Permission
p
)
{
if
(
permissions
!=
null
)
{
return
permissions
[
p
.
value
][
2
];
}
return
false
;
}
/**
* Sets the permissions for that file. Intended mostly to be used
* from inside an {@link java.net.FtpDirParser} implementation.
* The permissions array is a 3x3 {@code boolean} array, the first index being
* the User, group or owner (0, 1 and 2 respectively) while the second
* index is read, write or execute (0, 1 and 2 respectively again).
* <p>E.G.: {@code permissions[1][2]} is the group/execute permission.</p>
*
* @param permissions a 3x3 {@code boolean} array
* @return this {@code FtpDirEntry}
*/
public
FtpDirEntry
setPermissions
(
boolean
[][]
permissions
)
{
this
.
permissions
=
permissions
;
return
this
;
}
/**
* Adds a 'fact', as defined in RFC 3659, to the list of facts of this file.
* Intended mostly to be used from inside a {@link java.net.FtpDirParser}
* implementation.
*
* @param fact the name of the fact (e.g. "Media-Type"). It is not case-sensitive.
* @param value the value associated with this fact.
* @return this {@code FtpDirEntry}
*/
public
FtpDirEntry
addFact
(
String
fact
,
String
value
)
{
facts
.
put
(
fact
.
toLowerCase
(),
value
);
return
this
;
}
/**
* Returns the requested 'fact', as defined in RFC 3659, if available.
*
* @param fact The name of the fact *e.g. "Media-Type"). It is not case sensitive.
* @return The value of the fact or, {@code null} if that fact wasn't
* provided by the server.
*/
public
String
getFact
(
String
fact
)
{
return
facts
.
get
(
fact
.
toLowerCase
());
}
/**
* Returns the creation time of the file, when provided by the server.
*
* @return The Date representing the creation time, or {@code null}
* if the server didn't provide that information.
*/
public
Date
getCreated
()
{
return
created
;
}
/**
* Sets the creation time for that file. Intended mostly to be used from
* inside a {@link java.net.FtpDirParser} implementation.
*
* @param created the Date representing the creation time for that file, or
* {@code null} if that information is not available.
* @return this FtpDirEntry
*/
public
FtpDirEntry
setCreated
(
Date
created
)
{
this
.
created
=
created
;
return
this
;
}
/**
* Returns a string representation of the object.
* The {@code toString} method for class {@code FtpDirEntry}
* returns a string consisting of the name of the file, followed by its
* type between brackets, followed by the user and group between
* parenthesis, then size between '{', and, finally, the lastModified of last
* modification if it's available.
*
* @return a string representation of the object.
*/
@Override
public
String
toString
()
{
if
(
lastModified
==
null
)
{
return
name
+
" ["
+
type
+
"] ("
+
user
+
" / "
+
group
+
") "
+
size
;
}
return
name
+
" ["
+
type
+
"] ("
+
user
+
" / "
+
group
+
") {"
+
size
+
"} "
+
java
.
text
.
DateFormat
.
getDateInstance
().
format
(
lastModified
);
}
}
jdk/src/share/classes/sun/net/ftp/FtpDirParser.java
0 → 100644
浏览文件 @
a462b5ee
/*
* Copyright 2009 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
sun.net.ftp
;
/**
* This interface describes a parser for the FtpClient class. Such a parser is
* used when listing a remote directory to transform text lines like:
* drwxr-xr-x 1 user01 ftp 512 Jan 29 23:32 prog
* into FtpDirEntry instances.
*
* @see java.net.FtpClient#setFileParser(FtpDirParser)
* @since 1.7
*/
public
interface
FtpDirParser
{
/**
* Takes one line from a directory listing and returns an FtpDirEntry instance
* based on the information contained.
*
* @param line a <code>String</code>, a line sent by the FTP server as a
* result of the LST command.
* @return an <code>FtpDirEntry</code> instance.
* @see java.net.FtpDirEntry
*/
public
FtpDirEntry
parseLine
(
String
line
);
}
jdk/src/share/classes/sun/net/ftp/FtpLoginException.java
浏览文件 @
a462b5ee
/*
* Copyright 1994-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1994-200
9
Sun Microsystems, Inc. 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
...
...
@@ -25,7 +25,7 @@
package
sun.net.ftp
;
import
java.io.
*
;
import
java.io.
IOException
;
/**
* This exception is thrown when an error is encountered during an
...
...
@@ -33,10 +33,10 @@ import java.io.*;
*
* @author Jonathan Payne
*/
public
class
FtpLoginException
extends
FtpProtocol
Exception
{
public
class
FtpLoginException
extends
IO
Exception
{
private
static
final
long
serialVersionUID
=
2218162403237941536L
;
FtpLoginException
(
String
s
)
{
public
FtpLoginException
(
String
s
)
{
super
(
s
);
}
}
jdk/src/share/classes/sun/net/ftp/FtpProtocolException.java
浏览文件 @
a462b5ee
/*
* Copyright 1994-200
8
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1994-200
9
Sun Microsystems, Inc. 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
...
...
@@ -22,21 +22,49 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
sun.net.ftp
;
import
java.io.*
;
/**
* This exeception is thrown when unexpected results are returned during
* an FTP session.
*
* Thrown to indicate that the FTP server reported an error.
* For instance that the requested file doesn't exist or
* that a command isn't supported.
* <p>The specific error code can be retreived with {@link #getReplyCode() }.</p>
* @author Jonathan Payne
*/
public
class
FtpProtocolException
extends
IO
Exception
{
public
class
FtpProtocolException
extends
Exception
{
private
static
final
long
serialVersionUID
=
5978077070276545054L
;
private
final
FtpReplyCode
code
;
/**
* Constructs a new {@code FtpProtocolException} from the
* specified detail message. The reply code is set to unknow error.
*
* @param detail the detail message.
*/
public
FtpProtocolException
(
String
detail
)
{
super
(
detail
);
code
=
FtpReplyCode
.
UNKNOWN_ERROR
;
}
/**
* Constructs a new {@code FtpProtocolException} from the
* specified response code and exception detail message
*
* @param detail the detail message.
* @param code The {@code FtpRelyCode} received from server.
*/
public
FtpProtocolException
(
String
detail
,
FtpReplyCode
code
)
{
super
(
detail
);
this
.
code
=
code
;
}
FtpProtocolException
(
String
s
)
{
super
(
s
);
/**
* Gets the reply code sent by the server that led to this exception
* being thrown.
*
* @return The {@link FtpReplyCode} associated with that exception.
*/
public
FtpReplyCode
getReplyCode
()
{
return
code
;
}
}
jdk/src/share/classes/sun/net/ftp/FtpReplyCode.java
0 → 100644
浏览文件 @
a462b5ee
/*
* Copyright 2009 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
sun.net.ftp
;
/**
* This class describes a FTP protocol reply code and associates a meaning
* to the numerical value according to the various RFCs (RFC 959 in
* particular).
*
*/
public
enum
FtpReplyCode
{
RESTART_MARKER
(
110
),
SERVICE_READY_IN
(
120
),
DATA_CONNECTION_ALREADY_OPEN
(
125
),
FILE_STATUS_OK
(
150
),
COMMAND_OK
(
200
),
NOT_IMPLEMENTED
(
202
),
SYSTEM_STATUS
(
211
),
DIRECTORY_STATUS
(
212
),
FILE_STATUS
(
213
),
HELP_MESSAGE
(
214
),
NAME_SYSTEM_TYPE
(
215
),
SERVICE_READY
(
220
),
SERVICE_CLOSING
(
221
),
DATA_CONNECTION_OPEN
(
225
),
CLOSING_DATA_CONNECTION
(
226
),
ENTERING_PASSIVE_MODE
(
227
),
ENTERING_EXT_PASSIVE_MODE
(
229
),
LOGGED_IN
(
230
),
SECURELY_LOGGED_IN
(
232
),
SECURITY_EXCHANGE_OK
(
234
),
SECURITY_EXCHANGE_COMPLETE
(
235
),
FILE_ACTION_OK
(
250
),
PATHNAME_CREATED
(
257
),
NEED_PASSWORD
(
331
),
NEED_ACCOUNT
(
332
),
NEED_ADAT
(
334
),
NEED_MORE_ADAT
(
335
),
FILE_ACTION_PENDING
(
350
),
SERVICE_NOT_AVAILABLE
(
421
),
CANT_OPEN_DATA_CONNECTION
(
425
),
CONNECTION_CLOSED
(
426
),
NEED_SECURITY_RESOURCE
(
431
),
FILE_ACTION_NOT_TAKEN
(
450
),
ACTION_ABORTED
(
451
),
INSUFFICIENT_STORAGE
(
452
),
COMMAND_UNRECOGNIZED
(
500
),
INVALID_PARAMETER
(
501
),
BAD_SEQUENCE
(
503
),
NOT_IMPLEMENTED_FOR_PARAMETER
(
504
),
NOT_LOGGED_IN
(
530
),
NEED_ACCOUNT_FOR_STORING
(
532
),
PROT_LEVEL_DENIED
(
533
),
REQUEST_DENIED
(
534
),
FAILED_SECURITY_CHECK
(
535
),
UNSUPPORTED_PROT_LEVEL
(
536
),
PROT_LEVEL_NOT_SUPPORTED_BY_SECURITY
(
537
),
FILE_UNAVAILABLE
(
550
),
PAGE_TYPE_UNKNOWN
(
551
),
EXCEEDED_STORAGE
(
552
),
FILE_NAME_NOT_ALLOWED
(
553
),
PROTECTED_REPLY
(
631
),
UNKNOWN_ERROR
(
999
);
private
final
int
value
;
FtpReplyCode
(
int
val
)
{
this
.
value
=
val
;
}
/**
* Returns the numerical value of the code.
*
* @return the numerical value.
*/
public
int
getValue
()
{
return
value
;
}
/**
* Determines if the code is a Positive Preliminary response.
* This means beginning with a 1 (which means a value between 100 and 199)
*
* @return <code>true</code> if the reply code is a positive preliminary
* response.
*/
public
boolean
isPositivePreliminary
()
{
return
value
>=
100
&&
value
<
200
;
}
/**
* Determines if the code is a Positive Completion response.
* This means beginning with a 2 (which means a value between 200 and 299)
*
* @return <code>true</code> if the reply code is a positive completion
* response.
*/
public
boolean
isPositiveCompletion
()
{
return
value
>=
200
&&
value
<
300
;
}
/**
* Determines if the code is a positive internediate response.
* This means beginning with a 3 (which means a value between 300 and 399)
*
* @return <code>true</code> if the reply code is a positive intermediate
* response.
*/
public
boolean
isPositiveIntermediate
()
{
return
value
>=
300
&&
value
<
400
;
}
/**
* Determines if the code is a transient negative response.
* This means beginning with a 4 (which means a value between 400 and 499)
*
* @return <code>true</code> if the reply code is a transient negative
* response.
*/
public
boolean
isTransientNegative
()
{
return
value
>=
400
&&
value
<
500
;
}
/**
* Determines if the code is a permanent negative response.
* This means beginning with a 5 (which means a value between 500 and 599)
*
* @return <code>true</code> if the reply code is a permanent negative
* response.
*/
public
boolean
isPermanentNegative
()
{
return
value
>=
500
&&
value
<
600
;
}
/**
* Determines if the code is a protected reply response.
* This means beginning with a 6 (which means a value between 600 and 699)
*
* @return <code>true</code> if the reply code is a protected reply
* response.
*/
public
boolean
isProtectedReply
()
{
return
value
>=
600
&&
value
<
700
;
}
/**
* Determines if the code is a syntax related response.
* This means the second digit is a 0.
*
* @return <code>true</code> if the reply code is a syntax related
* response.
*/
public
boolean
isSyntax
()
{
return
((
value
/
10
)
-
((
value
/
100
)
*
10
))
==
0
;
}
/**
* Determines if the code is an information related response.
* This means the second digit is a 1.
*
* @return <code>true</code> if the reply code is an information related
* response.
*/
public
boolean
isInformation
()
{
return
((
value
/
10
)
-
((
value
/
100
)
*
10
))
==
1
;
}
/**
* Determines if the code is a connection related response.
* This means the second digit is a 2.
*
* @return <code>true</code> if the reply code is a connection related
* response.
*/
public
boolean
isConnection
()
{
return
((
value
/
10
)
-
((
value
/
100
)
*
10
))
==
2
;
}
/**
* Determines if the code is an authentication related response.
* This means the second digit is a 3.
*
* @return <code>true</code> if the reply code is an authentication related
* response.
*/
public
boolean
isAuthentication
()
{
return
((
value
/
10
)
-
((
value
/
100
)
*
10
))
==
3
;
}
/**
* Determines if the code is an unspecified type of response.
* This means the second digit is a 4.
*
* @return <code>true</code> if the reply code is an unspecified type of
* response.
*/
public
boolean
isUnspecified
()
{
return
((
value
/
10
)
-
((
value
/
100
)
*
10
))
==
4
;
}
/**
* Determines if the code is a file system related response.
* This means the second digit is a 5.
*
* @return <code>true</code> if the reply code is a file system related
* response.
*/
public
boolean
isFileSystem
()
{
return
((
value
/
10
)
-
((
value
/
100
)
*
10
))
==
5
;
}
/**
* Static utility method to convert a value into a FtpReplyCode.
*
* @param v the value to convert
* @return the <code>FtpReplyCode</code> associated with the value.
*/
public
static
FtpReplyCode
find
(
int
v
)
{
for
(
FtpReplyCode
code
:
FtpReplyCode
.
values
())
{
if
(
code
.
getValue
()
==
v
)
{
return
code
;
}
}
return
UNKNOWN_ERROR
;
}
}
jdk/src/share/classes/sun/net/ftp/impl/DefaultFtpClientProvider.java
0 → 100644
浏览文件 @
a462b5ee
/*
* Copyright 2009 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
sun.net.ftp.impl
;
/**
* Default FtpClientProvider.
* Uses sun.net.ftp.FtpCLient.
*/
public
class
DefaultFtpClientProvider
extends
sun
.
net
.
ftp
.
FtpClientProvider
{
@Override
public
sun
.
net
.
ftp
.
FtpClient
createFtpClient
()
{
return
sun
.
net
.
ftp
.
impl
.
FtpClient
.
create
();
}
}
jdk/src/share/classes/sun/net/ftp/impl/FtpClient.java
0 → 100644
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/src/share/classes/sun/net/www/protocol/http/DigestAuthentication.java
浏览文件 @
a462b5ee
...
...
@@ -277,14 +277,16 @@ class DigestAuthentication extends AuthenticationInfo {
params
.
setOpaque
(
p
.
findValue
(
"opaque"
));
params
.
setQop
(
p
.
findValue
(
"qop"
));
String
uri
;
String
uri
=
""
;
String
method
;
if
(
type
==
PROXY_AUTHENTICATION
&&
conn
.
tunnelState
()
==
HttpURLConnection
.
TunnelState
.
SETUP
)
{
uri
=
HttpURLConnection
.
connectRequestURI
(
conn
.
getURL
());
method
=
HTTP_CONNECT
;
}
else
{
uri
=
conn
.
getRequestURI
();
try
{
uri
=
conn
.
getRequestURI
();
}
catch
(
IOException
e
)
{}
method
=
conn
.
getMethod
();
}
...
...
jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
浏览文件 @
a462b5ee
...
...
@@ -1552,7 +1552,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* because ntlm does not support this feature.
*/
private
AuthenticationInfo
resetProxyAuthentication
(
AuthenticationInfo
proxyAuthentication
,
AuthenticationHeader
auth
)
{
resetProxyAuthentication
(
AuthenticationInfo
proxyAuthentication
,
AuthenticationHeader
auth
)
throws
IOException
{
if
((
proxyAuthentication
!=
null
)&&
proxyAuthentication
.
getAuthScheme
()
!=
NTLM
)
{
String
raw
=
auth
.
raw
();
...
...
@@ -1776,7 +1776,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
/**
* Sets pre-emptive proxy authentication in header
*/
private
void
setPreemptiveProxyAuthentication
(
MessageHeader
requests
)
{
private
void
setPreemptiveProxyAuthentication
(
MessageHeader
requests
)
throws
IOException
{
AuthenticationInfo
pauth
=
AuthenticationInfo
.
getProxyAuth
(
http
.
getProxyHostUsed
(),
http
.
getProxyPortUsed
());
...
...
@@ -2132,13 +2132,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
String
requestURI
=
null
;
String
getRequestURI
()
{
String
getRequestURI
()
throws
IOException
{
if
(
requestURI
==
null
)
{
try
{
requestURI
=
http
.
getURLFile
();
}
catch
(
IOException
e
)
{
requestURI
=
""
;
}
requestURI
=
http
.
getURLFile
();
}
return
requestURI
;
}
...
...
jdk/src/share/classes/sun/security/jca/Providers.java
浏览文件 @
a462b5ee
/*
* Copyright 2003-200
5
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2003-200
9
Sun Microsystems, Inc. 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
...
...
@@ -86,6 +86,9 @@ public class Providers {
private
static
final
String
[]
jarVerificationProviders
=
{
"sun.security.provider.Sun"
,
"sun.security.rsa.SunRsaSign"
,
// Note: SunEC *is* in a signed JAR file, but it's not signed
// by EC itself. So it's still safe to be listed here.
"sun.security.ec.SunEC"
,
BACKUP_PROVIDER_CLASSNAME
,
};
...
...
jdk/src/share/classes/sun/security/pkcs/SignerInfo.java
浏览文件 @
a462b5ee
/*
* Copyright 1996-200
6
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1996-200
9
Sun Microsystems, Inc. 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
...
...
@@ -286,8 +286,6 @@ public class SignerInfo implements DerEncoder {
}
String
digestAlgname
=
getDigestAlgorithmId
().
getName
();
if
(
digestAlgname
.
equalsIgnoreCase
(
"SHA"
))
digestAlgname
=
"SHA1"
;
byte
[]
dataSigned
;
...
...
@@ -337,9 +335,12 @@ public class SignerInfo implements DerEncoder {
String
encryptionAlgname
=
getDigestEncryptionAlgorithmId
().
getName
();
if
(
encryptionAlgname
.
equalsIgnoreCase
(
"SHA1withDSA"
))
encryptionAlgname
=
"DSA"
;
String
algname
=
digestAlgname
+
"with"
+
encryptionAlgname
;
// Workaround: sometimes the encryptionAlgname is actually
// a signature name
String
tmp
=
AlgorithmId
.
getEncAlgFromSigAlg
(
encryptionAlgname
);
if
(
tmp
!=
null
)
encryptionAlgname
=
tmp
;
String
algname
=
AlgorithmId
.
makeSigAlg
(
digestAlgname
,
encryptionAlgname
);
Signature
sig
=
Signature
.
getInstance
(
algname
);
X509Certificate
cert
=
getCertificate
(
block
);
...
...
jdk/src/share/classes/sun/security/tools/JarSigner.java
浏览文件 @
a462b5ee
...
...
@@ -1031,9 +1031,9 @@ public class JarSigner {
}
if
(
sigfile
.
length
()
>
8
)
{
sigfile
=
sigfile
.
substring
(
0
,
8
).
toUpperCase
();
sigfile
=
sigfile
.
substring
(
0
,
8
).
toUpperCase
(
Locale
.
ENGLISH
);
}
else
{
sigfile
=
sigfile
.
toUpperCase
();
sigfile
=
sigfile
.
toUpperCase
(
Locale
.
ENGLISH
);
}
StringBuilder
tmpSigFile
=
new
StringBuilder
(
sigfile
.
length
());
...
...
@@ -1083,8 +1083,8 @@ public class JarSigner {
ZipOutputStream
zos
=
new
ZipOutputStream
(
ps
);
/* First guess at what they might be - we don't xclude RSA ones. */
String
sfFilename
=
(
META_INF
+
sigfile
+
".SF"
).
toUpperCase
();
String
bkFilename
=
(
META_INF
+
sigfile
+
".DSA"
).
toUpperCase
();
String
sfFilename
=
(
META_INF
+
sigfile
+
".SF"
).
toUpperCase
(
Locale
.
ENGLISH
);
String
bkFilename
=
(
META_INF
+
sigfile
+
".DSA"
).
toUpperCase
(
Locale
.
ENGLISH
);
Manifest
manifest
=
new
Manifest
();
Map
<
String
,
Attributes
>
mfEntries
=
manifest
.
getEntries
();
...
...
@@ -1447,9 +1447,10 @@ public class JarSigner {
* . META-INF/*.SF
* . META-INF/*.DSA
* . META-INF/*.RSA
* . META-INF/*.EC
*/
private
boolean
signatureRelated
(
String
name
)
{
String
ucName
=
name
.
toUpperCase
();
String
ucName
=
name
.
toUpperCase
(
Locale
.
ENGLISH
);
if
(
ucName
.
equals
(
JarFile
.
MANIFEST_NAME
)
||
ucName
.
equals
(
META_INF
)
||
(
ucName
.
startsWith
(
SIG_PREFIX
)
&&
...
...
@@ -1459,7 +1460,7 @@ public class JarSigner {
if
(
ucName
.
startsWith
(
META_INF
)
&&
SignatureFileVerifier
.
isBlockOrSF
(
ucName
))
{
// .SF/.DSA/.RSA files in META-INF subdirs
// .SF/.DSA/.RSA
/.EC
files in META-INF subdirs
// are not considered signature-related
return
(
ucName
.
indexOf
(
"/"
)
==
ucName
.
lastIndexOf
(
"/"
));
}
...
...
@@ -2227,7 +2228,6 @@ class SignatureFile {
}
BigInteger
serial
=
certChain
[
0
].
getSerialNumber
();
String
digestAlgorithm
;
String
signatureAlgorithm
;
String
keyAlgorithm
=
privateKey
.
getAlgorithm
();
/*
...
...
@@ -2237,22 +2237,24 @@ class SignatureFile {
if
(
sigalg
==
null
)
{
if
(
keyAlgorithm
.
equalsIgnoreCase
(
"DSA"
))
digestAlgorithm
=
"SHA1
"
;
signatureAlgorithm
=
"SHA1withDSA
"
;
else
if
(
keyAlgorithm
.
equalsIgnoreCase
(
"RSA"
))
digestAlgorithm
=
"SHA256"
;
else
{
signatureAlgorithm
=
"SHA256withRSA"
;
else
if
(
keyAlgorithm
.
equalsIgnoreCase
(
"EC"
))
signatureAlgorithm
=
"SHA256withECDSA"
;
else
throw
new
RuntimeException
(
"private key is not a DSA or "
+
"RSA key"
);
}
signatureAlgorithm
=
digestAlgorithm
+
"with"
+
keyAlgorithm
;
}
else
{
signatureAlgorithm
=
sigalg
;
}
// check common invalid key/signature algorithm combinations
String
sigAlgUpperCase
=
signatureAlgorithm
.
toUpperCase
();
String
sigAlgUpperCase
=
signatureAlgorithm
.
toUpperCase
(
Locale
.
ENGLISH
);
if
((
sigAlgUpperCase
.
endsWith
(
"WITHRSA"
)
&&
!
keyAlgorithm
.
equalsIgnoreCase
(
"RSA"
))
||
(
sigAlgUpperCase
.
endsWith
(
"WITHECDSA"
)
&&
!
keyAlgorithm
.
equalsIgnoreCase
(
"EC"
))
||
(
sigAlgUpperCase
.
endsWith
(
"WITHDSA"
)
&&
!
keyAlgorithm
.
equalsIgnoreCase
(
"DSA"
)))
{
throw
new
SignatureException
...
...
jdk/src/share/classes/sun/security/tools/KeyTool.java
浏览文件 @
a462b5ee
...
...
@@ -1407,7 +1407,7 @@ public final class KeyTool {
}
else
if
(
"RSA"
.
equalsIgnoreCase
(
keyAlgName
))
{
return
"SHA256WithRSA"
;
}
else
if
(
"EC"
.
equalsIgnoreCase
(
keyAlgName
))
{
return
"SHA
1
withECDSA"
;
return
"SHA
256
withECDSA"
;
}
else
{
throw
new
Exception
(
rb
.
getString
(
"Cannot derive signature algorithm"
));
...
...
jdk/src/share/classes/sun/security/tools/TimestampedSigner.java
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/src/share/classes/sun/security/x509/AlgorithmId.java
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/src/share/classes/sun/tools/jar/SignatureFile.java
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/test/com/sun/jdi/ShellScaffold.sh
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/test/java/math/BigInteger/ExtremeShiftingTests.java
0 → 100644
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/test/java/net/CookieHandler/B6644726.java
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/test/sun/net/www/protocol/http/B6890349.java
0 → 100644
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
jdk/test/sun/security/tools/jarsigner/ec.sh
0 → 100644
浏览文件 @
a462b5ee
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录