eu.emi.security.authn.x509.impl
Class OpensslNameUtils

java.lang.Object
  extended by eu.emi.security.authn.x509.impl.OpensslNameUtils

public class OpensslNameUtils
extends Object

This class provides support for the legacy Openssl format of DN encoding. Please do not use this format unless it is absolutely necessary. It has a number of problems see particular methods documentation for details.

Author:
K. Benedyczak

Field Summary
static Map<String,String> NORMALIZED_LABELS
          Holds mappings of labels which occur in the wild but are output differently by OpenSSL.
 
Constructor Summary
OpensslNameUtils()
           
 
Method Summary
static String convertFromRfc2253(String srcDn, boolean globusFlavouring)
          Returns an OpenSSL legacy (and as of now the default in OpenSSL) encoding of the provided RFC 2253 DN.
static String normalize(String legacyDN)
          Performs cleaning of the provided openssl legacy DN.
static String opensslToRfc2253(String inputDN)
          Deprecated. This method is not planned for removal but it is marked as deprecated as it is highly unreliable and you should update your code not to use openssl style DNs at all
static String opensslToRfc2253(String inputDN, boolean withWildcards)
          Deprecated. This method is not planned for removal but it is marked as deprecated as it is highly unreliable and you should update your code not to use openssl style DNs at all
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMALIZED_LABELS

public static final Map<String,String> NORMALIZED_LABELS
Holds mappings of labels which occur in the wild but are output differently by OpenSSL. Also useful to have a uniform representation when creating a normalized form. Note that in some cases OpenSSL doesn't have a label -> then an oid is used.

Constructor Detail

OpensslNameUtils

public OpensslNameUtils()
Method Detail

normalize

public static String normalize(String legacyDN)
Performs cleaning of the provided openssl legacy DN. The following actions are performed: Please note that this normalization is far from being perfect: non-ascii characters encoded in hex are not lower-cased, it may happen that some tokens are not in the map, values containing '/TOKEN=' as a substring will be messed up.

Parameters:
legacyDN -
Returns:
normalized string (hopefully) suitable for the string comparison

opensslToRfc2253

@Deprecated
public static String opensslToRfc2253(String inputDN)
Deprecated. This method is not planned for removal but it is marked as deprecated as it is highly unreliable and you should update your code not to use openssl style DNs at all

Parameters:
inputDN -
Returns:
RFC 2253 representation of the input
Since:
1.1.0
See Also:
with second arg equal to false

opensslToRfc2253

@Deprecated
public static String opensslToRfc2253(String inputDN,
                                                 boolean withWildcards)
Deprecated. This method is not planned for removal but it is marked as deprecated as it is highly unreliable and you should update your code not to use openssl style DNs at all

Tries to convert the OpenSSL string representation of a DN into a RFC 2253 form. The conversion is as follows:
  1. the string is split on '/',
  2. all resulting parts which have no '=' sign inside are glued with the previous element
  3. parts are output with ',' as a separator in reversed order.

Parameters:
inputDN -
withWildcards - whether '*' wildcards need to be recognized
Returns:
RFC 2253 representation of the input
Since:
1.1.0

convertFromRfc2253

public static String convertFromRfc2253(String srcDn,
                                        boolean globusFlavouring)
Returns an OpenSSL legacy (and as of now the default in OpenSSL) encoding of the provided RFC 2253 DN. Please note that this method is:


Copyright © 2012-2013 European Middleware Initiative. All Rights Reserved.