| | |
| | | |
| | | |
| | | /** |
| | | * This class defines a number of constants that may be used when |
| | | * interacting with ASN.1 elements. |
| | | * This class defines a number of constants that may be used when interacting |
| | | * with ASN.1 elements. |
| | | */ |
| | | public final class ASN1Constants |
| | | { |
| | | |
| | | // Prevent instantiation. |
| | | private ASN1Constants() |
| | | { |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** |
| | | * The ASN.1 element decoding state that indicates that the next byte |
| | | * read should be the BER type for a new element. |
| | | * The ASN.1 element decoding state that indicates that the next byte read |
| | | * should be the BER type for a new element. |
| | | */ |
| | | static final int ELEMENT_READ_STATE_NEED_TYPE = 0; |
| | | |
| | | /** |
| | | * The ASN.1 element decoding state that indicates that the next byte |
| | | * read should be the first byte for the element length. |
| | | * The ASN.1 element decoding state that indicates that the next byte read |
| | | * should be the first byte for the element length. |
| | | */ |
| | | static final int ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE = 1; |
| | | |
| | | /** |
| | | * The ASN.1 element decoding state that indicates that the next byte |
| | | * read should be additional bytes of a multi-byte length. |
| | | * The ASN.1 element decoding state that indicates that the next byte read |
| | | * should be additional bytes of a multi-byte length. |
| | | */ |
| | | static final int ELEMENT_READ_STATE_NEED_ADDITIONAL_LENGTH_BYTES = 2; |
| | | |
| | | /** |
| | | * The ASN.1 element decoding state that indicates that the next byte |
| | | * read should be applied to the value of the element. |
| | | * The ASN.1 element decoding state that indicates that the next byte read |
| | | * should be applied to the value of the element. |
| | | */ |
| | | static final int ELEMENT_READ_STATE_NEED_VALUE_BYTES = 3; |
| | | |
| | |
| | | static final byte[] NO_VALUE = new byte[0]; |
| | | |
| | | /** |
| | | * The bitmask that can be ANDed with the BER type to zero out all |
| | | * bits except those used in the class. |
| | | * The bitmask that can be ANDed with the BER type to zero out all bits except |
| | | * those used in the class. |
| | | */ |
| | | static final byte TYPE_MASK_ALL_BUT_CLASS = (byte) 0xC0; |
| | | |
| | | /** |
| | | * The bitmask that can be ANDed with the BER type to determine if the |
| | | * element is in the universal class. |
| | | * The bitmask that can be ANDed with the BER type to determine if the element |
| | | * is in the universal class. |
| | | */ |
| | | static final byte TYPE_MASK_UNIVERSAL = 0x00; |
| | | |
| | | /** |
| | | * The bitmask that can be ANDed with the BER type to determine if the |
| | | * element is in the application-specific class. |
| | | * The bitmask that can be ANDed with the BER type to determine if the element |
| | | * is in the application-specific class. |
| | | */ |
| | | static final byte TYPE_MASK_APPLICATION = 0x40; |
| | | |
| | | /** |
| | | * The bitmask that can be ANDed with the BER type to determine if the |
| | | * element is in the context-specific class. |
| | | * The bitmask that can be ANDed with the BER type to determine if the element |
| | | * is in the context-specific class. |
| | | */ |
| | | static final byte TYPE_MASK_CONTEXT = (byte) 0x80; |
| | | |
| | | /** |
| | | * The bitmask that can be ANDed with the BER type to determine if the |
| | | * element is in the private class. |
| | | * The bitmask that can be ANDed with the BER type to determine if the element |
| | | * is in the private class. |
| | | */ |
| | | static final byte TYPE_MASK_PRIVATE = (byte) 0xC0; |
| | | |
| | | /** |
| | | * The bitmask that can be ANDed with the BER type to zero out all |
| | | * bits except the primitive/constructed bit. |
| | | * The bitmask that can be ANDed with the BER type to zero out all bits except |
| | | * the primitive/constructed bit. |
| | | */ |
| | | static final byte TYPE_MASK_ALL_BUT_PC = (byte) 0x20; |
| | | |
| | | /** |
| | | * The bitmask that can be ANDed with the BER type to determine if the |
| | | * element is a primitive. |
| | | * The bitmask that can be ANDed with the BER type to determine if the element |
| | | * is a primitive. |
| | | */ |
| | | static final byte TYPE_MASK_PRIMITIVE = 0x00; |
| | | |
| | | /** |
| | | * The bitmask that can be ANDed with the BER type to determine if the |
| | | * element is constructed. |
| | | * The bitmask that can be ANDed with the BER type to determine if the element |
| | | * is constructed. |
| | | */ |
| | | static final byte TYPE_MASK_CONSTRUCTED = 0x20; |
| | | |
| | | /** |
| | | * The byte array containing the pre-encoded ASN.1 encoding for a |
| | | * boolean value of "false". |
| | | * The byte array containing the pre-encoded ASN.1 encoding for a boolean |
| | | * value of "false". |
| | | */ |
| | | public static final byte BOOLEAN_VALUE_FALSE = 0x00; |
| | | |
| | | /** |
| | | * The byte array containing the pre-encoded ASN.1 encoding for a |
| | | * boolean value of "false". |
| | | * The byte array containing the pre-encoded ASN.1 encoding for a boolean |
| | | * value of "false". |
| | | */ |
| | | public static final byte BOOLEAN_VALUE_TRUE = (byte) 0xFF; |
| | | |
| | | |
| | | |
| | | // Prevent instantiation. |
| | | private ASN1Constants() |
| | | { |
| | | // Nothing to do. |
| | | } |
| | | } |