本文整理汇总了Java中javax.security.auth.x500.X500Principal.toString方法的典型用法代码示例。如果您正苦于以下问题:Java X500Principal.toString方法的具体用法?Java X500Principal.toString怎么用?Java X500Principal.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.security.auth.x500.X500Principal
的用法示例。
在下文中一共展示了X500Principal.toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import javax.security.auth.x500.X500Principal; //导入方法依赖的package包/类
@Override
public String toString ()
{
if ( this.certificate instanceof X509Certificate )
{
final X500Principal subject = ( (X509Certificate)this.certificate ).getSubjectX500Principal ();
if ( subject != null )
{
return subject.toString ();
}
}
if ( this.key != null )
{
return this.key.toString ();
}
else
{
return null;
}
}
示例2: testName
import javax.security.auth.x500.X500Principal; //导入方法依赖的package包/类
public static void testName(String in, String outFormat,
String expect, int n)
throws Exception {
X500Principal p = new X500Principal(in);
if (outFormat.equalsIgnoreCase("toString")) {
if (p.toString().equals(expect)) {
System.out.println("test " + n + " succeeded");
} else {
throw new SecurityException("test " + n + " failed:\n" +
"expected '" + expect + "'\n" +
"got '" + p.toString() + "'");
}
} else {
if (p.getName(outFormat).equals(expect)) {
System.out.println("test " + n + " succeeded");
} else {
throw new SecurityException("test " + n + " failed:\n" +
"expected '" + expect + "'\n" +
"got '" + p.getName(outFormat) + "'");
}
}
}