public class BasicAttConstraints extends V3Extension
BasicAttConstraints
Extension.
If this extension is included in the certificate and the BasicAttConstrints
extension may be critical or
non critical. However, it is recommended to be critical, otherwise a holder which is not authorized to be an AttributeAuthority
(AA) may issue certificates containing the specified privilege.
The BasicAttConstrints extension is associated with a specific certificateExtension
object identifier, derived from:
basicAttConstraints EXTENSION ::= { SYNTAX BasicAttConstraintsSyntax IDENTIFIED BY { id-ce-basicAttConstraints }} BasicAttConstraintsSyntax ::= SEQUENCE {authority BOOLEAN DEFAULT FALSE, pathLenConstraint INTEGER (0..MAX) OPTIONAL}
which corresponds to the OID string "2.5.29.41".
If
More information can be found in ITU Recommendation X.509, is section 15.5.2.1 "Basic attribute constraints extension".
An BasicAttConstrints
object may be created by either using the empty default
constructor, or by directly supplying one access descritption which has to be of
type AccessDescription
, e.g.:
BasicAttConstraints bac = new BasicAttConstraints(); bac.setAutority(false); bac.setCritical(true);For adding a
BasicAttConstraint
extension object to a X509Certificate, use
the addExtension
method of the X509Certificate
class:
X505Certificate cert = new X509Certificate(); ... cert.addExtension(basicAttConstraint);
Note: This extension should not be included in certificates containing the SOA extension.
GeneralName
,
ObjectID
,
V3Extension
,
X509Extensions
,
X509Certificate
Modifier and Type | Field and Description |
---|---|
static ObjectID |
oid |
critical
Constructor and Description |
---|
BasicAttConstraints()
Default constructor that creates an empty
BasicAttConstraint extension element. |
Modifier and Type | Method and Description |
---|---|
boolean |
getAuthority()
Returns wether the
|
ObjectID |
getObjectID()
Returns the object ID of this
BasicAttConstraints extension. |
int |
getPathLenConstraint()
Returns the value of the encoded pathlen constraint.
|
int |
hashCode()
Returns the hash code of the extension.
|
void |
init(ASN1Object arg0)
Parses a given
|
void |
setAutority(boolean flag)
Sets the authority flag to the specified value.
|
void |
setPathlenConstraint(int len)
Sets the maximum length of the delegation path.
|
ASN1Object |
toASN1Object()
Returns the ASN.1 representation of the extension.
|
java.lang.String |
toString()
Returns a string that represents the contents of
this
BasicAttConstraint object. |
getName, isCritical, setCritical
public static final ObjectID oid
public BasicAttConstraints()
BasicAttConstraint
extension element.public ASN1Object toASN1Object() throws X509ExtensionException
toASN1Object
in class V3Extension
X509ExtensionException
- if the extension could not be createdpublic void init(ASN1Object arg0) throws X509ExtensionException
getAuthority()
and getPathLenConstraint()
.init
in class V3Extension
arg0
- the extension value as ASN1ObjectX509ExtensionException
- if authority is true and the encoded pathLen is negative.public boolean getAuthority()
public int getPathLenConstraint()
public void setPathlenConstraint(int len)
len
- public void setAutority(boolean flag)
flag
- public int hashCode()
hashCode
in class V3Extension
public ObjectID getObjectID()
BasicAttConstraints
extension.getObjectID
in class V3Extension
public java.lang.String toString()
BasicAttConstraint
object.toString
in class java.lang.Object