org.glite.slcs.pki.bouncycastle
Class X509PrincipalUtil

java.lang.Object
  extended by org.glite.slcs.pki.bouncycastle.X509PrincipalUtil

public class X509PrincipalUtil
extends java.lang.Object

Utility class to handle correctly the creation of X509Principal. The BouncyCastle library (version <= 1.39) doesn't handle correctly escaped literal characters (+, =, ...) in the Principal name.

Bug report in BouncyCastle JIRA: http://www.bouncycastle.org/jira/browse/BJA-119

Usage:

 X509PrincipalUtil util = new X509PrincipalUtil();
 X509Principal p = util.createX509Principal("CN=Foo\\+Bar,O=SWITCH+O=MAMS,C=CH+C=AU");
 

Version:
$Revision: 1.2 $
Author:
Valery Tschopp <tschopp@switch.ch>, Xuan Thang Nguyen <xuan.nguyen@its.monash.edu.au>

Constructor Summary
X509PrincipalUtil()
           
 
Method Summary
 org.bouncycastle.jce.X509Principal createX509Principal(java.lang.String name)
          Creates a X509Principal with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

X509PrincipalUtil

public X509PrincipalUtil()
Method Detail

createX509Principal

public org.bouncycastle.jce.X509Principal createX509Principal(java.lang.String name)
                                                       throws java.security.GeneralSecurityException
Creates a X509Principal with the given name.

In the name the RDNs, like CN=B+CN=A, will be sorted alphabetically. Literal characters like +, = must be escaped.

Parameters:
name - The X509Principal name.
Returns:
the X509Principal.
Throws:
java.security.GeneralSecurityException - if an error occurs.