anon.crypto
Class AbstractX509AlternativeName

java.lang.Object
  extended by anon.crypto.AbstractX509Extension
      extended by anon.crypto.AbstractX509AlternativeName
Direct Known Subclasses:
X509IssuerAlternativeName, X509SubjectAlternativeName

public abstract class AbstractX509AlternativeName
extends AbstractX509Extension

The SubjectAlternativeName extension represents an alias to distinguished name (DN). It may contain several values and is often used for IPs, DNS-Names, URLs and E-Mail addresses.

Author:
Rolf Wendolsky
See Also:
http://www.faqs.org/rfcs/rfc2538.html

Field Summary
private  java.util.Vector m_tags
           
private  java.util.Vector m_values
           
static java.lang.Integer TAG_DNS
           
static java.lang.Integer TAG_EMAIL
           
static java.lang.Integer TAG_IP
           
static java.lang.Integer TAG_OTHER
           
static java.lang.Integer TAG_URL
           
 
Fields inherited from class anon.crypto.AbstractX509Extension
IDENTIFIER
 
Constructor Summary
AbstractX509AlternativeName(org.bouncycastle.asn1.DERSequence a_extension)
          Creates an X509AlternativeName from a BouncyCastle DER sequence.
AbstractX509AlternativeName(java.lang.String a_identifier, boolean a_critical, java.lang.String a_value, java.lang.Integer a_tag)
          Constructs a new X509AlternativeName from a value.
AbstractX509AlternativeName(java.lang.String a_identifier, boolean a_critical, java.util.Vector a_values, java.util.Vector a_tags)
          Constructs a new X509AlternativeName from values.
AbstractX509AlternativeName(java.lang.String a_identifier, java.lang.String a_value, java.lang.Integer a_tag)
          Constructs a new X509AlternativeName from a value.
AbstractX509AlternativeName(java.lang.String a_identifier, java.util.Vector a_values, java.util.Vector a_tags)
          Constructs a new X509AlternativeName from values.
 
Method Summary
private static byte[] createValue(java.util.Vector a_values, java.util.Vector a_tags)
           
 java.util.Vector getTags()
          Returns the tags corresponding to the values as Integer objects.
 java.util.Vector getValues()
          Returns all values of this X509AlternativeName.
static boolean isValidEMail(java.lang.String a_email)
          Verifies if a given String is a valid email address (IPv4 or IPv6).
static boolean isValidIP(java.lang.String a_ipAddress)
          Verifies if a given String is a valid IP address (IPv4 or IPv6)
 
Methods inherited from class anon.crypto.AbstractX509Extension
equals, getBCExtension, getDEROctets, getIdentifier, getInstance, getName, hashCode, isCritical, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TAG_OTHER

public static final java.lang.Integer TAG_OTHER

TAG_EMAIL

public static final java.lang.Integer TAG_EMAIL

TAG_DNS

public static final java.lang.Integer TAG_DNS

TAG_URL

public static final java.lang.Integer TAG_URL

TAG_IP

public static final java.lang.Integer TAG_IP

m_values

private java.util.Vector m_values

m_tags

private java.util.Vector m_tags
Constructor Detail

AbstractX509AlternativeName

public AbstractX509AlternativeName(java.lang.String a_identifier,
                                   java.lang.String a_value,
                                   java.lang.Integer a_tag)
Constructs a new X509AlternativeName from a value. A value with commas (,) is interpreted as multiple values.

Parameters:
a_identifier - the identifier of this extension
a_value - a value
a_tag - the type tag for this value

AbstractX509AlternativeName

public AbstractX509AlternativeName(java.lang.String a_identifier,
                                   boolean a_critical,
                                   java.lang.String a_value,
                                   java.lang.Integer a_tag)
Constructs a new X509AlternativeName from a value. A value with commas (,) is interpreted as multiple values.

Parameters:
a_identifier - the identifier of this extension
a_critical - true if the X509AlternativeName is critical; false otherwise
a_value - a value
a_tag - the type tag for this value

AbstractX509AlternativeName

public AbstractX509AlternativeName(java.lang.String a_identifier,
                                   java.util.Vector a_values,
                                   java.util.Vector a_tags)
Constructs a new X509AlternativeName from values.

Parameters:
a_identifier - the identifier of this extension
a_values - values for the X509AlternativeName
a_tags - the type tags for the values

AbstractX509AlternativeName

public AbstractX509AlternativeName(java.lang.String a_identifier,
                                   boolean a_critical,
                                   java.util.Vector a_values,
                                   java.util.Vector a_tags)
Constructs a new X509AlternativeName from values.

Parameters:
a_identifier - the identifier of this extension
a_critical - true if the extension is critical; false otherwise
a_values - values for the X509AlternativeName
a_tags - the type tags for the values

AbstractX509AlternativeName

public AbstractX509AlternativeName(org.bouncycastle.asn1.DERSequence a_extension)
Creates an X509AlternativeName from a BouncyCastle DER sequence. For internal use only.

Parameters:
a_extension - a DERSequence
Method Detail

isValidIP

public static boolean isValidIP(java.lang.String a_ipAddress)
Verifies if a given String is a valid IP address (IPv4 or IPv6)

Parameters:
a_ipAddress - an IP address as String
Returns:
if a given String is a valid IP address; false otherwise

isValidEMail

public static boolean isValidEMail(java.lang.String a_email)
Verifies if a given String is a valid email address (IPv4 or IPv6). There may be more than one addresses in the string, separated by commas (,).

Parameters:
a_email - an email address as String
Returns:
if a given String is a valid email address; false otherwise

getValues

public java.util.Vector getValues()
Returns all values of this X509AlternativeName.

Specified by:
getValues in class AbstractX509Extension
Returns:
all values of this X509AlternativeName

getTags

public java.util.Vector getTags()
Returns the tags corresponding to the values as Integer objects.

Returns:
the tags corresponding to the values as Integer objects

createValue

private static byte[] createValue(java.util.Vector a_values,
                                  java.util.Vector a_tags)