Package de.cardcontact.tlv
Class DirectoryAttribute
- java.lang.Object
-
- de.cardcontact.tlv.TLV
-
- de.cardcontact.tlv.ConstructedTLV
-
- de.cardcontact.tlv.Sequence
-
- de.cardcontact.tlv.DirectoryAttribute
-
- All Implemented Interfaces:
TreeNode
public class DirectoryAttribute extends Sequence
Handle SubjectDirectoryAttribute constructs from X.509 The class implements the following ASN.1 syntax Attribute ::= SEQUENCE { type AttributeType, values SET OF AttributeValue } AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY- Author:
- Andreas Schwier (info@cardcontact.de)
-
-
Field Summary
-
Fields inherited from class de.cardcontact.tlv.ConstructedTLV
childs
-
Fields inherited from class de.cardcontact.tlv.TLV
alternateLengthFormat, name, tag
-
-
Constructor Summary
Constructors Constructor Description DirectoryAttribute(ObjectIdentifier newoid)
Create DirectoryAttribute object with given object identifierDirectoryAttribute(TLV tlv)
Create DirectoryAttribute from TLV structure
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElement(TLV element)
Add TLV element to value SET of attributevoid
addGeneralizedTime(java.util.Date date)
Add date encoded as generalized time to value SET of attributevoid
addLatin1String(java.lang.String latin1String)
Add Latin-1 encoded string to value SET of attributevoid
addNumericString(java.lang.String numericString)
Add numeric string to value SET of attributevoid
addPrintableString(java.lang.String printableString)
Add Plain string encoded string to value SET of attributevoid
addUTF8String(java.lang.String utf8String)
Add UTF-8 encoded string to value SET of attributeTLV
getElement(int tag)
Return TLV element with given tag from SET of attributesjava.util.Date
getGeneralizedTime()
Return date from value set of attributejava.lang.String
getLatin1String()
Return Latin-1 string from value set of attributejava.lang.String
getNumericString()
Return numeric string from value set of attributeObjectIdentifier
getOID()
Return object identifierjava.lang.String
getPrintableString()
Return printable string from value set of attributejava.lang.String
getString(int tag, java.lang.String encoding)
Find string with given tag and decode using given encoding formatjava.lang.String
getUTF8String()
Return UTF-8 string from value set of attributeboolean
isOID(ObjectIdentifier testoid)
Test if directory attribute has given object identifier-
Methods inherited from class de.cardcontact.tlv.Sequence
getInstance, getInstance
-
Methods inherited from class de.cardcontact.tlv.ConstructedTLV
add, add, dump, findTag, get, getChildAt, getChildCount, getElements, getIndex, getLength, getParent, isLeaf, remove, toByteArray, valueToByteArray
-
Methods inherited from class de.cardcontact.tlv.TLV
dump, dumpSingleLine, factory, factory, factory, getBytes, getLengthFieldAsByteArray, getLengthFieldSize, getLengthFieldSizeHelper, getName, getSize, getTag, getValue, lengthFromByteArray, lengthToByteArray, setName, setTag, toString, useAlternateLengthEncoding
-
-
-
-
Constructor Detail
-
DirectoryAttribute
public DirectoryAttribute(ObjectIdentifier newoid)
Create DirectoryAttribute object with given object identifier- Parameters:
newoid
- Object identifier for attribute
-
DirectoryAttribute
public DirectoryAttribute(TLV tlv) throws TLVEncodingException
Create DirectoryAttribute from TLV structure- Parameters:
tlv
- TLV object- Throws:
TLVEncodingException
- Data structure can not be converted
-
-
Method Detail
-
addElement
public void addElement(TLV element)
Add TLV element to value SET of attribute- Parameters:
element
- TLV object to be added
-
getElement
public TLV getElement(int tag)
Return TLV element with given tag from SET of attributes- Parameters:
tag
-- Returns:
- TLV object or null if object was not found
-
getString
public java.lang.String getString(int tag, java.lang.String encoding) throws java.io.UnsupportedEncodingException
Find string with given tag and decode using given encoding format- Parameters:
tag
- Tag to look forencoding
- Encoding format (e.g. "UTF-8" or "8859_1")- Returns:
- String or null if object was not found
- Throws:
java.io.UnsupportedEncodingException
- Character string can not be encoded
-
addNumericString
public void addNumericString(java.lang.String numericString) throws java.io.UnsupportedEncodingException
Add numeric string to value SET of attribute- Parameters:
numericString
-- Throws:
java.io.UnsupportedEncodingException
-
getNumericString
public java.lang.String getNumericString() throws java.io.UnsupportedEncodingException
Return numeric string from value set of attribute- Returns:
- String or null if object was not found
- Throws:
java.io.UnsupportedEncodingException
-
addUTF8String
public void addUTF8String(java.lang.String utf8String) throws java.io.UnsupportedEncodingException
Add UTF-8 encoded string to value SET of attribute- Throws:
java.io.UnsupportedEncodingException
-
getUTF8String
public java.lang.String getUTF8String() throws java.io.UnsupportedEncodingException
Return UTF-8 string from value set of attribute- Returns:
- String or null if object was not found
- Throws:
java.io.UnsupportedEncodingException
-
addPrintableString
public void addPrintableString(java.lang.String printableString) throws java.io.UnsupportedEncodingException
Add Plain string encoded string to value SET of attribute- Parameters:
printableString
- Plain String- Throws:
java.io.UnsupportedEncodingException
-
getPrintableString
public java.lang.String getPrintableString() throws java.io.UnsupportedEncodingException
Return printable string from value set of attribute- Returns:
- String or null if object was not found
- Throws:
java.io.UnsupportedEncodingException
-
addLatin1String
public void addLatin1String(java.lang.String latin1String) throws java.io.UnsupportedEncodingException
Add Latin-1 encoded string to value SET of attribute- Parameters:
latin1String
- Unicode string- Throws:
java.io.UnsupportedEncodingException
-
getLatin1String
public java.lang.String getLatin1String() throws java.io.UnsupportedEncodingException
Return Latin-1 string from value set of attribute- Returns:
- String or null if object was not found
- Throws:
java.io.UnsupportedEncodingException
-
addGeneralizedTime
public void addGeneralizedTime(java.util.Date date) throws java.io.UnsupportedEncodingException
Add date encoded as generalized time to value SET of attribute- Parameters:
date
- Date to add- Throws:
java.io.UnsupportedEncodingException
-
getGeneralizedTime
public java.util.Date getGeneralizedTime() throws java.io.UnsupportedEncodingException
Return date from value set of attribute- Returns:
- date
- Throws:
java.io.UnsupportedEncodingException
-
getOID
public ObjectIdentifier getOID()
Return object identifier- Returns:
- Object identifier
-
isOID
public boolean isOID(ObjectIdentifier testoid)
Test if directory attribute has given object identifier- Parameters:
testoid
- Object identifier to test for.- Returns:
- True if the directory attribute has given object identifier
-
-