1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.xml.security.x509;
18
19 import javax.security.auth.x500.X500Principal;
20
21
22
23
24
25 public class InternalX500DNHandler implements X500DNHandler {
26
27
28 public byte[] getEncoded(X500Principal principal) {
29 if (principal == null) {
30 throw new NullPointerException("X500Principal may not be null");
31 }
32 return principal.getEncoded();
33 }
34
35
36 public String getName(X500Principal principal) {
37 if (principal == null) {
38 throw new NullPointerException("X500Principal may not be null");
39 }
40 return principal.getName();
41 }
42
43
44 public String getName(X500Principal principal, String format) {
45 if (principal == null) {
46 throw new NullPointerException("X500Principal may not be null");
47 }
48 return principal.getName(format);
49 }
50
51
52 public X500Principal parse(String name) {
53 if (name == null) {
54 throw new NullPointerException("X.500 name string may not be null");
55 }
56 return new X500Principal(name);
57 }
58
59
60 public X500Principal parse(byte[] name) {
61 if (name == null) {
62 throw new NullPointerException("X.500 DER-encoded name may not be null");
63 }
64 return new X500Principal(name);
65 }
66
67
68 public X500DNHandler clone() {
69
70 return new InternalX500DNHandler();
71 }
72
73 }