Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d6f770d9
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d6f770d9
编写于
3月 14, 2008
作者:
M
mullan
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
b515cbce
10ce0b96
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
98 addition
and
1 deletion
+98
-1
src/share/classes/sun/security/x509/AVA.java
src/share/classes/sun/security/x509/AVA.java
+6
-1
test/javax/security/auth/x500/X500Principal/RFC4514.java
test/javax/security/auth/x500/X500Principal/RFC4514.java
+92
-0
未找到文件。
src/share/classes/sun/security/x509/AVA.java
浏览文件 @
d6f770d9
...
@@ -780,7 +780,8 @@ public class AVA implements DerEncoder {
...
@@ -780,7 +780,8 @@ public class AVA implements DerEncoder {
* Implementations MAY escape other characters.
* Implementations MAY escape other characters.
*
*
* NOTE: this implementation also recognizes "=" and "#" as
* NOTE: this implementation also recognizes "=" and "#" as
* characters which need escaping.
* characters which need escaping, and null which is escaped as
* '\00' (see RFC 4514).
*
*
* If a character to be escaped is one of the list shown above, then
* If a character to be escaped is one of the list shown above, then
* it is prefixed by a backslash ('\' ASCII 92).
* it is prefixed by a backslash ('\' ASCII 92).
...
@@ -805,6 +806,10 @@ public class AVA implements DerEncoder {
...
@@ -805,6 +806,10 @@ public class AVA implements DerEncoder {
// append printable/escaped char
// append printable/escaped char
sbuffer
.
append
(
c
);
sbuffer
.
append
(
c
);
}
else
if
(
c
==
'\u0000'
)
{
// escape null character
sbuffer
.
append
(
"\\00"
);
}
else
if
(
debug
!=
null
&&
Debug
.
isOn
(
"ava"
))
{
}
else
if
(
debug
!=
null
&&
Debug
.
isOn
(
"ava"
))
{
// embed non-printable/non-escaped char
// embed non-printable/non-escaped char
...
...
test/javax/security/auth/x500/X500Principal/RFC4514.java
0 → 100644
浏览文件 @
d6f770d9
/*
* Copyright 2008 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.
*
* 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.
*/
import
javax.security.auth.x500.X500Principal
;
/**
* @test
* @bug 6611991
* @summary Add support for parsing RFC 4514 DNs to X500Principal
*
* Ensure RFC 4514 Distinguished Name Strings can be parsed by X500Principal.
* RFC 4514 obsoleted RFC 2253 so we should make sure we can parse DNs of
* that form that contain subtle differences or clarifications in the grammar.
*/
public
class
RFC4514
{
private
int
failed
=
0
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
new
RFC4514
().
test
();
}
private
void
test
()
throws
Exception
{
/**
* RFC 4514 allows space to be escaped as '\ '.
*/
parse
(
"CN=\\ Space\\ ,C=US"
);
parse
(
"CN=Sp\\ ace,C=US"
);
/**
* RFC 4514 does not require escaping of '=' characters.
*/
parse
(
"CN=Eq=uals,C=US"
);
/**
* RFC 4514 requires the null character to be escaped.
*/
parse
(
"CN=\\00,C=US"
);
/**
* RFC 4514 does not require escaping of non-leading '#' characters.
*/
parse
(
"CN=Num#ber,C=US"
);
/**
* XMLDSig (http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/)
* allows implementations to escape trailing whitespace as '\20'.
*/
parse
(
"CN=Trailing \\20,C=US"
);
/**
* XMLDSig allows implementations to escape ASCII control characters
* (Unicode range \x00 - \x1f) by replacing them with "\" followed by
* a two digit hex number showing its Unicode number.
*/
parse
(
"CN=Con\\09trol,C=US"
);
if
(
failed
!=
0
)
{
throw
new
Exception
(
"Some RFC4514 tests FAILED"
);
}
}
public
void
parse
(
String
dnString
)
throws
Exception
{
System
.
out
.
println
(
"Parsing "
+
dnString
);
X500Principal
dn
=
new
X500Principal
(
dnString
);
String
dnString2
=
dn
.
getName
();
X500Principal
dn2
=
new
X500Principal
(
dnString2
);
if
(
dn
.
equals
(
dn2
))
{
System
.
out
.
println
(
"PASSED"
);
}
else
{
System
.
out
.
println
(
"FAILED"
);
failed
++;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录