Welcome to mirror list, hosted at ThFree Co, Russian Federation.

X500NameStyle.java « x500 « asn1 « spongycastle « org « java « main « src « core - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8c7161705f78752c2e23345ca765b14efbc76970 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package org.spongycastle.asn1.x500;

import org.spongycastle.asn1.ASN1Encodable;
import org.spongycastle.asn1.ASN1ObjectIdentifier;

/**
 * It turns out that the number of standard ways the fields in a DN should be 
 * encoded into their ASN.1 counterparts is rapidly approaching the
 * number of machines on the internet. By default the X500Name class
 * will produce UTF8Strings in line with the current recommendations (RFC 3280).
 * <p>
 */
public interface X500NameStyle
{
    /**
     * Convert the passed in String value into the appropriate ASN.1
     * encoded object.
     * 
     * @param oid the OID associated with the value in the DN.
     * @param value the value of the particular DN component.
     * @return the ASN.1 equivalent for the value.
     */
    ASN1Encodable stringToValue(ASN1ObjectIdentifier oid, String value);

    /**
     * Return the OID associated with the passed in name.
     *
     * @param attrName the string to match.
     * @return an OID
     */
    ASN1ObjectIdentifier attrNameToOID(String attrName);

    /**
     * Return an array of RDN generated from the passed in String.
     * @param dirName  the String representation.
     * @return  an array of corresponding RDNs.
     */
    RDN[] fromString(String dirName);

    /**
     * Return true if the two names are equal.
     *
     * @param name1 first name for comparison.
     * @param name2 second name for comparison.
     * @return true if name1 = name 2, false otherwise.
     */
    boolean areEqual(X500Name name1, X500Name name2);

    /**
     * Calculate a hashCode for the passed in name.
     *
     * @param name the name the hashCode is required for.
     * @return the calculated hashCode.
     */
    int calculateHashCode(X500Name name);

    /**
     * Convert the passed in X500Name to a String.
     * @param name the name to convert.
     * @return a String representation.
     */
    String toString(X500Name name);

    /**
     * Return the display name for toString() associated with the OID.
     *
     * @param oid  the OID of interest.
     * @return the name displayed in toString(), null if no mapping provided.
     */
    String oidToDisplayName(ASN1ObjectIdentifier oid);

    /**
     * Return the acceptable names in a String DN that map to OID.
     *
     * @param oid  the OID of interest.
     * @return an array of String aliases for the OID, zero length if there are none.
     */
    String[] oidToAttrNames(ASN1ObjectIdentifier oid);
}