public class

SubjectAlternativeNameExtension

extends Extension
implements CertAttrSet<T>
java.lang.Object
   ↳ sun.security.x509.Extension
     ↳ sun.security.x509.SubjectAlternativeNameExtension

Class Overview

This represents the Subject Alternative Name Extension. This extension, if present, allows the subject to specify multiple alternative names.

Extensions are represented as a sequence of the extension identifier (Object Identifier), a boolean flag stating whether the extension is to be treated as being critical and the extension value itself (this is again a DER encoding of the extension value).

The ASN.1 syntax for this is:

 SubjectAltName ::= GeneralNames
 GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
 

Summary

Constants
String IDENT Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.
String NAME Attribute names.
String SUBJECT_NAME
[Expand]
Inherited Fields
From class sun.security.x509.Extension
Public Constructors
SubjectAlternativeNameExtension(GeneralNames names)
Create a SubjectAlternativeNameExtension with the passed GeneralNames.
SubjectAlternativeNameExtension(Boolean critical, GeneralNames names)
Create a SubjectAlternativeNameExtension with the specified criticality and GeneralNames.
SubjectAlternativeNameExtension()
Create a default SubjectAlternativeNameExtension.
SubjectAlternativeNameExtension(Boolean critical, Object value)
Create the extension from the passed DER encoded value.
Public Methods
void delete(String name)
Delete the attribute value.
void encode(OutputStream out)
Write the extension to the OutputStream.
Object get(String name)
Get the attribute value.
Enumeration<String> getElements()
Return an enumeration of names of attributes existing within this attribute.
String getName()
Return the name of this attribute.
void set(String name, Object obj)
Set the attribute value.
String toString()
Returns a printable representation of the SubjectAlternativeName.
[Expand]
Inherited Methods
From class sun.security.x509.Extension
From class java.lang.Object
From interface sun.security.x509.CertAttrSet

Constants

public static final String IDENT

Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.

Constant Value: "x509.info.extensions.SubjectAlternativeName"

public static final String NAME

Attribute names.

Constant Value: "SubjectAlternativeName"

public static final String SUBJECT_NAME

Constant Value: "subject_name"

Public Constructors

public SubjectAlternativeNameExtension (GeneralNames names)

Create a SubjectAlternativeNameExtension with the passed GeneralNames. The extension is marked non-critical.

Parameters
names the GeneralNames for the subject.
Throws
IOException on error.

public SubjectAlternativeNameExtension (Boolean critical, GeneralNames names)

Create a SubjectAlternativeNameExtension with the specified criticality and GeneralNames.

Parameters
critical true if the extension is to be treated as critical.
names the GeneralNames for the subject.
Throws
IOException on error.

public SubjectAlternativeNameExtension ()

Create a default SubjectAlternativeNameExtension. The extension is marked non-critical.

public SubjectAlternativeNameExtension (Boolean critical, Object value)

Create the extension from the passed DER encoded value.

Parameters
critical true if the extension is to be treated as critical.
value an array of DER encoded bytes of the actual value.
Throws
ClassCastException if value is not an array of bytes
IOException on error.

Public Methods

public void delete (String name)

Delete the attribute value.

Parameters
name the name of the attribute to delete.
Throws
IOException

public void encode (OutputStream out)

Write the extension to the OutputStream.

Parameters
out the OutputStream to write the extension to.
Throws
IOException on encoding errors.

public Object get (String name)

Get the attribute value.

Parameters
name the name of the attribute to return.
Throws
IOException

public Enumeration<String> getElements ()

Return an enumeration of names of attributes existing within this attribute.

Returns
  • an enumeration of the attribute names.

public String getName ()

Return the name of this attribute.

Returns
  • the name of this CertAttrSet.

public void set (String name, Object obj)

Set the attribute value.

Parameters
name the name of the attribute (e.g. "x509.info.key")
obj the attribute object.
Throws
IOException

public String toString ()

Returns a printable representation of the SubjectAlternativeName.

Returns
  • a string representation of the object.