Code example for X500Principal

Methods: getName

0
        m.put("BAR", "1.2.3");
        p = new X500Principal("BAR=user", m);
 
        // override builtin keywords 
        m = Collections.singletonMap("CN", "1.2.3");
        p = new X500Principal("CN=user", m);
        if (!p.getName().startsWith("1.2.3")) {
            throw new Exception("mapping did not override builtin keyword");
        } 
 
        // override builtin OIDs 
        m = Collections.singletonMap("FOO", "2.5.4.3");
        p = new X500Principal("FOO=sean", m);
        if (!p.getName().startsWith("CN")) {
            throw new Exception("mapping did not override builtin OID");
        } 
    } 
}