Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
X509GenericName | 34 | 4 | 0% | 4 | 8 |
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 java.io.IOException; | |
23 | ||
24 | import org.bouncycastle.asn1.ASN1Primitive; | |
25 | import org.bouncycastle.asn1.x509.GeneralName; | |
26 | import org.xwiki.crypto.pkix.internal.extension.BcGeneralName; | |
27 | ||
28 | /** | |
29 | * Generic holder for general name not supported by specific class. | |
30 | * | |
31 | * @version $Id: a155a5e9157ea1a25ad74f36830df339f7008942 $ | |
32 | * @since 5.4 | |
33 | */ | |
34 | public class X509GenericName implements X509GeneralName, BcGeneralName | |
35 | { | |
36 | private final GeneralName name; | |
37 | ||
38 | /** | |
39 | * Create a new instance from a encoded ASN.1 value. | |
40 | * | |
41 | * @param tag the tag value. | |
42 | * @param encoded the encoded ASN.1 value. | |
43 | * @throws IOException on encoding error. | |
44 | */ | |
45 | 0 | public X509GenericName(int tag, byte[] encoded) throws IOException |
46 | { | |
47 | 0 | this.name = new GeneralName(tag, ASN1Primitive.fromByteArray(encoded)); |
48 | } | |
49 | ||
50 | /** | |
51 | * Create a new instance from a encoded ASN.1 name. | |
52 | * | |
53 | * @param encoded the encoded ASN.1 value. | |
54 | * @throws IOException on encoding error. | |
55 | */ | |
56 | 0 | public X509GenericName(byte[] encoded) throws IOException |
57 | { | |
58 | 0 | this.name = GeneralName.getInstance(encoded); |
59 | } | |
60 | ||
61 | /** | |
62 | * Create a new instance from a Bouncy Castle general name. | |
63 | * | |
64 | * @param name the Bouncy Castle general name. | |
65 | */ | |
66 | 0 | public X509GenericName(GeneralName name) |
67 | { | |
68 | 0 | this.name = name; |
69 | } | |
70 | ||
71 | 0 | @Override |
72 | public GeneralName getGeneralName() | |
73 | { | |
74 | 0 | return this.name; |
75 | } | |
76 | } |