/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Represents the CRL Issuing Distribution Point Extension (OID = 2.5.29.28).
*
* <p>
* The issuing distribution point is a critical CRL extension that
* identifies the CRL distribution point and scope for a particular CRL,
* and it indicates whether the CRL covers revocation for end entity
* certificates only, CA certificates only, attribute certificates only,
* or a limited set of reason codes.
*
* <p>
* The extension is defined in Section 5.2.5 of
* <a href="http://www.ietf.org/rfc/rfc3280.txt">Internet X.509 PKI Certific
ate and Certificate Revocation List (CRL) Profile</a>.
*
* <p>
* Its ASN.1 definition is as follows:
* <pre>
* id-ce-issuingDistributionPoint OBJECT IDENTIFIER ::= { id-ce 28 }
*
* issuingDistributionPoint ::= SEQUENCE {
* distributionPoint [0] DistributionPointName OPTIONAL,
* onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE,
* onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE,
* onlySomeReasons [3] ReasonFlags OPTIONAL,
* indirectCRL [4] BOOLEAN DEFAULT FALSE,
* onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
* </pre>
*
* @see DistributionPoint
* @since 1.6
*/
implements CertAttrSet<String> {
/**
* Identifier for this attribute, to be used with the
* get, set, delete methods of Certificate, x509 type.
*/
"x509.info.extensions.IssuingDistributionPoint";
/**
* Attribute names.
*/
/*
* The distribution point name for the CRL.
*/
/*
* The scope settings for the CRL.
*/
private boolean hasOnlyUserCerts = false;
private boolean hasOnlyCACerts = false;
private boolean hasOnlyAttributeCerts = false;
private boolean isIndirectCRL = false;
/*
* ASN.1 context specific tag values
*/
/**
* Creates a critical IssuingDistributionPointExtension.
*
* @param distributionPoint the name of the distribution point, or null for
* none.
* @param revocationReasons the revocation reasons associated with the
* distribution point, or null for none.
* @param hasOnlyUserCerts if <code>true</code> then scope of the CRL
* includes only user certificates.
* @param hasOnlyCACerts if <code>true</code> then scope of the CRL
* includes only CA certificates.
* @param hasOnlyAttributeCerts if <code>true</code> then scope of the CRL
* includes only attribute certificates.
* @param isIndirectCRL if <code>true</code> then the scope of the CRL
* includes certificates issued by authorities other than the CRL
* issuer. The responsible authority is indicated by a certificate
* issuer CRL entry extension.
* @throws IllegalArgumentException if more than one of
* <code>hasOnlyUserCerts</code>, <code>hasOnlyCACerts</code>,
* <code>hasOnlyAttributeCerts</code> is set to <code>true</code>.
* @throws IOException on encoding error.
*/
boolean hasOnlyUserCerts, boolean hasOnlyCACerts,
boolean hasOnlyAttributeCerts, boolean isIndirectCRL)
throws IOException {
throw new IllegalArgumentException(
"Only one of hasOnlyUserCerts, hasOnlyCACerts, " +
"hasOnlyAttributeCerts may be set to true");
}
this.critical = true;
this.distributionPoint = distributionPoint;
this.revocationReasons = revocationReasons;
this.hasOnlyUserCerts = hasOnlyUserCerts;
this.hasOnlyCACerts = hasOnlyCACerts;
this.isIndirectCRL = isIndirectCRL;
encodeThis();
}
/**
* Creates a critical IssuingDistributionPointExtension from its
* DER-encoding.
*
* @param critical true if the extension is to be treated as critical.
* @param value the DER-encoded value. It must be a <code>byte[]</code>.
* @exception IOException on decoding error.
*/
throws IOException {
if (!(value instanceof byte[])) {
throw new IOException("Illegal argument type");
}
extensionValue = (byte[])value;
throw new IOException("Invalid encoding for " +
"IssuingDistributionPointExtension.");
}
// All the elements in issuingDistributionPoint are optional
return;
}
opt.isConstructed()) {
!opt.isConstructed()) {
!opt.isConstructed()) {
!opt.isConstructed()) {
!opt.isConstructed()) {
!opt.isConstructed()) {
} else {
throw new IOException
("Invalid encoding of IssuingDistributionPoint");
}
}
}
/**
* Returns the name of this attribute.
*/
return NAME;
}
/**
* Encodes the issuing distribution point extension and writes it to the
* DerOutputStream.
*
* @param out the output stream.
* @exception IOException on encoding error.
*/
if (this.extensionValue == null) {
this.critical = false;
encodeThis();
}
}
/**
* Sets the attribute value.
*/
if (!(obj instanceof DistributionPointName)) {
throw new IOException(
"Attribute value should be of type DistributionPointName.");
}
if (!(obj instanceof ReasonFlags)) {
throw new IOException(
"Attribute value should be of type ReasonFlags.");
}
throw new IOException(
"Attribute value should be of type Boolean.");
}
throw new IOException(
"Attribute value should be of type Boolean.");
}
throw new IOException(
"Attribute value should be of type Boolean.");
}
throw new IOException(
"Attribute value should be of type Boolean.");
}
} else {
"] not recognized by " +
"CertAttrSet:IssuingDistributionPointExtension.");
}
encodeThis();
}
/**
* Gets the attribute value.
*/
return distributionPoint;
return revocationReasons;
} else {
"] not recognized by " +
"CertAttrSet:IssuingDistributionPointExtension.");
}
}
/**
* Deletes the attribute value.
*/
isIndirectCRL = false;
hasOnlyUserCerts = false;
hasOnlyCACerts = false;
hasOnlyAttributeCerts = false;
} else {
"] not recognized by " +
"CertAttrSet:IssuingDistributionPointExtension.");
}
encodeThis();
}
/**
* Returns an enumeration of names of attributes existing within this
* attribute.
*/
}
// Encodes this extension value
if (distributionPoint == null &&
revocationReasons == null &&
!hasOnlyUserCerts &&
!hasOnlyCACerts &&
!isIndirectCRL) {
this.extensionValue = null;
return;
}
if (distributionPoint != null) {
}
if (hasOnlyUserCerts) {
}
if (hasOnlyCACerts) {
TAG_ONLY_CA_CERTS), tmp);
}
if (revocationReasons != null) {
}
if (isIndirectCRL) {
TAG_INDIRECT_CRL), tmp);
}
if (hasOnlyAttributeCerts) {
}
}
/**
* Returns the extension as user readable string.
*/
if (distributionPoint != null) {
}
if (revocationReasons != null) {
}
? (" Only contains user certs: true")
? (" Only contains CA certs: true")
? (" Only contains attribute certs: true")
? (" Indirect CRL: true")
}
}