/*
* 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.
*/
/**
* This class defines the Extended Key Usage Extension, which
* indicates one or more purposes for which the certified public key
* may be used, in addition to or in place of the basic purposes
* indicated in the key usage extension field. This field is defined
* as follows:<p>
*
* id-ce-extKeyUsage OBJECT IDENTIFIER ::= {id-ce 37}<p>
*
* ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId<p>
*
* KeyPurposeId ::= OBJECT IDENTIFIER<p>
*
* Key purposes may be defined by any organization with a need. Object
* identifiers used to identify key purposes shall be assigned in
*
* This extension may, at the option of the certificate issuer, be
* either critical or non-critical.<p>
*
* If the extension is flagged critical, then the certificate MUST be
* used only for one of the purposes indicated.<p>
*
* If the extension is flagged non-critical, then it indicates the
* intended purpose or purposes of the key, and may be used in finding
* the correct key/certificate of an entity that has multiple
* keys/certificates. It is an advisory field and does not imply that
* usage of the key is restricted by the certification authority to
* the purpose indicated. Certificate using applications may
* nevertheless require that a particular purpose be indicated in
* order for the certificate to be acceptable to that application.<p>
* If a certificate contains both a critical key usage field and a
* critical extended key usage field, then both fields MUST be
* processed independently and the certificate MUST only be used for a
* purpose consistent with both fields. If there is no purpose
* consistent with both fields, then the certificate MUST NOT be used
* for any purpose.<p>
*
* @since 1.4
*/
implements CertAttrSet<String> {
/**
* Identifier for this attribute, to be used with the
* get, set, delete methods of Certificate, x509 type.
*/
/**
* Attribute names.
*/
// OID defined in RFC 3280 Sections 4.2.1.13
static {
};
/**
* Vector of KeyUsages for this object.
*/
// Encode this extension value.
this.extensionValue = null;
return;
}
}
}
/**
* Create a ExtendedKeyUsageExtension object from
* a Vector of Key Usages; the criticality is set to false.
*
* @param keyUsages the Vector of KeyUsages (ObjectIdentifiers)
*/
throws IOException {
}
/**
* Create a ExtendedKeyUsageExtension object from
* a Vector of KeyUsages with specified criticality.
*
* @param critical true if the extension is to be treated as critical.
* @param keyUsages the Vector of KeyUsages (ObjectIdentifiers)
*/
throws IOException {
encodeThis();
}
/**
* Create the extension from its DER encoded value and criticality.
*
* @param critical true if the extension is to be treated as critical.
* @param value an array of DER encoded bytes of the actual value.
* @exception ClassCastException if value is not an array of bytes
* @exception IOException on error.
*/
throws IOException {
this.extensionValue = (byte[]) value;
throw new IOException("Invalid encoding for " +
"ExtendedKeyUsageExtension.");
}
}
}
/**
* Return the extension as user readable string.
*/
boolean first = true;
if(!first) {
usage += "\n ";
}
} else {
}
first = false;
}
return super.toString() + "ExtendedKeyUsages [\n"
+ usage + "\n]\n";
}
/**
* Write the extension to the DerOutputStream.
*
* @param out the DerOutputStream to write the extension to.
* @exception IOException on encoding errors.
*/
if (extensionValue == null) {
critical = false;
encodeThis();
}
}
/**
* Set the attribute value.
*/
throw new IOException("Attribute value should be of type Vector.");
}
} else {
"] not recognized by " +
"CertAttrSet:ExtendedKeyUsageExtension.");
}
encodeThis();
}
/**
* Get the attribute value.
*/
//XXXX May want to consider cloning this
return keyUsages;
} else {
"] not recognized by " +
"CertAttrSet:ExtendedKeyUsageExtension.");
}
}
/**
* Delete the attribute value.
*/
} else {
"] not recognized by " +
"CertAttrSet:ExtendedKeyUsageExtension.");
}
encodeThis();
}
/**
* Return an enumeration of names of attributes existing within this
* attribute.
*/
}
/**
* Return the name of this attribute.
*/
return (NAME);
}
}
return al;
}
}