Package org.wildfly.security.asn1
Class ASN1
- java.lang.Object
-
- org.wildfly.security.asn1.ASN1
-
public class ASN1 extends Object
A class that contains ASN.1 constants and utilities.- Author:
- Farah Juma
-
-
Field Summary
Fields Modifier and Type Field Description static intAPPLICATION_SPECIFIC_MASKMask used to determine if a type tag is application-specific.static intBIT_STRING_TYPEThe universal bit string type tag.static intBMP_STRING_TYPEThe universal BMP (UTF-16 big-endian) string type tag.static intBOOLEAN_TYPEThe universal boolean type tag.static intCLASS_MASKMask used to obtain the class bits from a type tag.static intCONSTRUCTED_MASKMask used to determine if a type tag is constructed.static intCONTEXT_SPECIFIC_MASKMask used to determine if a type tag is context-specific.static intGENERALIZED_TIME_TYPEA type for representing timestamps.static intIA5_STRING_TYPEThe universal IA5 string type tag.static intINTEGER_TYPEThe universal integer type tag.static intNULL_TYPEThe universal null type tag.static intOBJECT_IDENTIFIER_TYPEThe universal object identifier type tag.static intOCTET_STRING_TYPEThe universal octet string type tag.static StringOID_DSAAlgorithm ID for DSA keys used for any purpose.static StringOID_ECAlgorithm ID for EC keys used for any purpose.static StringOID_EXTENSION_REQUESTObject identifier for the PKCS #9extensionRequestattribute.static StringOID_MD2Object identifier for the MD2 hash algorithm.static StringOID_MD2_WITH_RSAObject identifier for the MD2 with RSA signature algorithm.static StringOID_MD4_WITH_RSAObject identifier for the MD4 with RSA signature algorithm.static StringOID_MD5Object identifier for the MD5 hash algorithm.static StringOID_MD5_WITH_RSAObject identifier for the MD5 with RSA signature algorithm.static StringOID_RSAAlgorithm ID for RSA keys used for any purpose.static StringOID_SHA1Object identifier for the SHA1 hash algorithm.static StringOID_SHA1_WITH_DSAObject identifier for the SHA1 with DSA signature algorithm.static StringOID_SHA1_WITH_ECDSAObject identifier for the SHA1 with ECDSA signature algorithm.static StringOID_SHA1_WITH_RSAObject identifier for the SHA1 with RSA signature algorithm.static StringOID_SHA224_WITH_ECDSAObject identifier for the SHA-225 with ECDSA signature algorithm.static StringOID_SHA256_WITH_DSAObject identifier for the SHA256 with DSA signature algorithm.static StringOID_SHA256_WITH_ECDSAObject identifier for the SHA-256 with ECDSA signature algorithm.static StringOID_SHA256_WITH_RSAObject identifier for the SHA-256 with RSA signature algorithm.static StringOID_SHA384_WITH_ECDSAObject identifier for the SHA-384 with ECDSA signature algorithm.static StringOID_SHA384_WITH_RSAObject identifier for the SHA-384 with RSA signature algorithm.static StringOID_SHA512_WITH_ECDSAObject identifier for the SHA-512 with ECDSA signature algorithm.static StringOID_SHA512_WITH_RSAObject identifier for the SHA-512 with RSA signature algorithm.static intPRINTABLE_STRING_TYPEThe universal printable string type tag.static intSEQUENCE_TYPEThe universal sequence type tag.static intSET_TYPEThe universal set type tag.static intTAG_NUMBER_MASKMask used to obtain the tag number bits from a type tag.static intUNIVERSAL_STRING_TYPEThe universal (UTF-32 big-endian) string type tag.static intUTF8_STRING_TYPEThe universal UTF-8 string type tag.
-
Constructor Summary
Constructors Constructor Description ASN1()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringformatAsn1(ASN1Decoder decoder)Format an AS.1 string from the given decoder as a string.static voidformatAsn1(ASN1Decoder decoder, StringBuilder builder)Format an ASN.1 string from the given decoder as a string.static StringkeyAlgorithmFromOid(String oid)Resolves a key algorithm based on a givenoid.static StringoidFromSignatureAlgorithm(String algorithmName)static StringsignatureAlgorithmFromOid(String oid)static voidvalidatePrintableByte(int b)
-
-
-
Field Detail
-
BOOLEAN_TYPE
public static final int BOOLEAN_TYPE
The universal boolean type tag.- See Also:
- Constant Field Values
-
INTEGER_TYPE
public static final int INTEGER_TYPE
The universal integer type tag.- See Also:
- Constant Field Values
-
BIT_STRING_TYPE
public static final int BIT_STRING_TYPE
The universal bit string type tag.- See Also:
- Constant Field Values
-
OCTET_STRING_TYPE
public static final int OCTET_STRING_TYPE
The universal octet string type tag.- See Also:
- Constant Field Values
-
NULL_TYPE
public static final int NULL_TYPE
The universal null type tag.- See Also:
- Constant Field Values
-
OBJECT_IDENTIFIER_TYPE
public static final int OBJECT_IDENTIFIER_TYPE
The universal object identifier type tag.- See Also:
- Constant Field Values
-
UTF8_STRING_TYPE
public static final int UTF8_STRING_TYPE
The universal UTF-8 string type tag.- See Also:
- Constant Field Values
-
PRINTABLE_STRING_TYPE
public static final int PRINTABLE_STRING_TYPE
The universal printable string type tag.- See Also:
- Constant Field Values
-
IA5_STRING_TYPE
public static final int IA5_STRING_TYPE
The universal IA5 string type tag.- See Also:
- Constant Field Values
-
GENERALIZED_TIME_TYPE
public static final int GENERALIZED_TIME_TYPE
A type for representing timestamps.- See Also:
- Constant Field Values
-
UNIVERSAL_STRING_TYPE
public static final int UNIVERSAL_STRING_TYPE
The universal (UTF-32 big-endian) string type tag.- See Also:
- Constant Field Values
-
BMP_STRING_TYPE
public static final int BMP_STRING_TYPE
The universal BMP (UTF-16 big-endian) string type tag.- See Also:
- Constant Field Values
-
SEQUENCE_TYPE
public static final int SEQUENCE_TYPE
The universal sequence type tag.- See Also:
- Constant Field Values
-
SET_TYPE
public static final int SET_TYPE
The universal set type tag.- See Also:
- Constant Field Values
-
CONSTRUCTED_MASK
public static final int CONSTRUCTED_MASK
Mask used to determine if a type tag is constructed.- See Also:
- Constant Field Values
-
APPLICATION_SPECIFIC_MASK
public static final int APPLICATION_SPECIFIC_MASK
Mask used to determine if a type tag is application-specific.- See Also:
- Constant Field Values
-
CONTEXT_SPECIFIC_MASK
public static final int CONTEXT_SPECIFIC_MASK
Mask used to determine if a type tag is context-specific.- See Also:
- Constant Field Values
-
CLASS_MASK
public static final int CLASS_MASK
Mask used to obtain the class bits from a type tag.- See Also:
- Constant Field Values
-
TAG_NUMBER_MASK
public static final int TAG_NUMBER_MASK
Mask used to obtain the tag number bits from a type tag.- See Also:
- Constant Field Values
-
OID_SHA1_WITH_DSA
public static final String OID_SHA1_WITH_DSA
Object identifier for the SHA1 with DSA signature algorithm.- See Also:
- Constant Field Values
-
OID_SHA256_WITH_DSA
public static final String OID_SHA256_WITH_DSA
Object identifier for the SHA256 with DSA signature algorithm.- Since:
- 1.2.0
- See Also:
- Constant Field Values
-
OID_SHA1_WITH_ECDSA
public static final String OID_SHA1_WITH_ECDSA
Object identifier for the SHA1 with ECDSA signature algorithm.- See Also:
- Constant Field Values
-
OID_SHA224_WITH_ECDSA
public static final String OID_SHA224_WITH_ECDSA
Object identifier for the SHA-225 with ECDSA signature algorithm.- See Also:
- Constant Field Values
-
OID_SHA256_WITH_ECDSA
public static final String OID_SHA256_WITH_ECDSA
Object identifier for the SHA-256 with ECDSA signature algorithm.- See Also:
- Constant Field Values
-
OID_SHA384_WITH_ECDSA
public static final String OID_SHA384_WITH_ECDSA
Object identifier for the SHA-384 with ECDSA signature algorithm.- See Also:
- Constant Field Values
-
OID_SHA512_WITH_ECDSA
public static final String OID_SHA512_WITH_ECDSA
Object identifier for the SHA-512 with ECDSA signature algorithm.- See Also:
- Constant Field Values
-
OID_MD2_WITH_RSA
public static final String OID_MD2_WITH_RSA
Object identifier for the MD2 with RSA signature algorithm.- See Also:
- Constant Field Values
-
OID_MD4_WITH_RSA
public static final String OID_MD4_WITH_RSA
Object identifier for the MD4 with RSA signature algorithm.- See Also:
- Constant Field Values
-
OID_MD5_WITH_RSA
public static final String OID_MD5_WITH_RSA
Object identifier for the MD5 with RSA signature algorithm.- See Also:
- Constant Field Values
-
OID_SHA1_WITH_RSA
public static final String OID_SHA1_WITH_RSA
Object identifier for the SHA1 with RSA signature algorithm.- See Also:
- Constant Field Values
-
OID_SHA256_WITH_RSA
public static final String OID_SHA256_WITH_RSA
Object identifier for the SHA-256 with RSA signature algorithm.- See Also:
- Constant Field Values
-
OID_SHA384_WITH_RSA
public static final String OID_SHA384_WITH_RSA
Object identifier for the SHA-384 with RSA signature algorithm.- See Also:
- Constant Field Values
-
OID_SHA512_WITH_RSA
public static final String OID_SHA512_WITH_RSA
Object identifier for the SHA-512 with RSA signature algorithm.- See Also:
- Constant Field Values
-
OID_EXTENSION_REQUEST
public static final String OID_EXTENSION_REQUEST
Object identifier for the PKCS #9extensionRequestattribute.- Since:
- 1.2.0
- See Also:
- Constant Field Values
-
OID_MD2
public static final String OID_MD2
Object identifier for the MD2 hash algorithm.- See Also:
- Constant Field Values
-
OID_MD5
public static final String OID_MD5
Object identifier for the MD5 hash algorithm.- See Also:
- Constant Field Values
-
OID_SHA1
public static final String OID_SHA1
Object identifier for the SHA1 hash algorithm.- See Also:
- Constant Field Values
-
OID_RSA
public static final String OID_RSA
Algorithm ID for RSA keys used for any purpose.- See Also:
- Constant Field Values
-
OID_DSA
public static final String OID_DSA
Algorithm ID for DSA keys used for any purpose.- See Also:
- Constant Field Values
-
OID_EC
public static final String OID_EC
Algorithm ID for EC keys used for any purpose.- See Also:
- Constant Field Values
-
-
Method Detail
-
formatAsn1
public static String formatAsn1(ASN1Decoder decoder)
Format an AS.1 string from the given decoder as a string.- Parameters:
decoder- the ASN.1 decoder- Returns:
- the formatted string
-
formatAsn1
public static void formatAsn1(ASN1Decoder decoder, StringBuilder builder)
Format an ASN.1 string from the given decoder as a string.- Parameters:
decoder- the ASN.1 decoderbuilder- the target string builder
-
keyAlgorithmFromOid
public static String keyAlgorithmFromOid(String oid)
Resolves a key algorithm based on a givenoid.- Parameters:
oid- an ASN.1 object identifier or OID (notnull)- Returns:
- the string representing the key algorithm or null if no algorithm could be resolved for the given OID
-
validatePrintableByte
public static void validatePrintableByte(int b) throws ASN1Exception- Throws:
ASN1Exception
-
-