Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
X509DirectoryName | 33 | 5 | 0% | 4 | 2 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.crypto.pkix.params.x509certificate.extension; | |
21 | ||
22 | import org.bouncycastle.asn1.x500.X500Name; | |
23 | import org.bouncycastle.asn1.x509.GeneralName; | |
24 | import org.xwiki.crypto.pkix.internal.extension.BcGeneralName; | |
25 | import org.xwiki.crypto.pkix.params.x509certificate.DistinguishedName; | |
26 | ||
27 | /** | |
28 | * X.509 Directory name general name. | |
29 | * | |
30 | * @version $Id: f8ec3daa8239e04ea11765ef8a6cee91d3bc8aa1 $ | |
31 | * @since 5.4 | |
32 | */ | |
33 | public class X509DirectoryName extends DistinguishedName implements X509StringGeneralName, BcGeneralName | |
34 | { | |
35 | /** | |
36 | * Create a new directory name. | |
37 | * | |
38 | * @param name the DN name like in "CN=Common Name, O=Organisation" | |
39 | */ | |
40 | 1 | public X509DirectoryName(Object name) |
41 | { | |
42 | 1 | super(name); |
43 | } | |
44 | ||
45 | /** | |
46 | * Create a new instance from a Bouncy Castle general name. | |
47 | * | |
48 | * @param name the Bouncy Castle general name. | |
49 | */ | |
50 | 1 | public X509DirectoryName(GeneralName name) |
51 | { | |
52 | 1 | super(X500Name.getInstance(name.getName())); |
53 | ||
54 | 1 | if (name.getTagNo() != GeneralName.directoryName) { |
55 | 0 | throw new IllegalArgumentException("Incompatible general name: " + name.getTagNo()); |
56 | } | |
57 | } | |
58 | ||
59 | 1 | @Override |
60 | public GeneralName getGeneralName() | |
61 | { | |
62 | 1 | return new GeneralName(getX500Name()); |
63 | } | |
64 | } |