/*
* 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.
*/
/**
* PolicyInformation is the class that contains a specific certificate policy
* that is part of the CertificatePoliciesExtension. A
* CertificatePolicyExtension value consists of a vector of these objects.
* <p>
* The ASN.1 syntax for PolicyInformation (IMPLICIT tagging is defined in the
* module definition):
* <pre>
*
* PolicyInformation ::= SEQUENCE {
* policyIdentifier CertPolicyId,
* policyQualifiers SEQUENCE SIZE (1..MAX) OF
* PolicyQualifierInfo OPTIONAL }
*
* CertPolicyId ::= OBJECT IDENTIFIER
*
* PolicyQualifierInfo ::= SEQUENCE {
* policyQualifierId PolicyQualifierId,
* qualifier ANY DEFINED BY policyQualifierId }
* </pre>
*
* @author Sean Mullan
* @author Anne Anderson
* @since 1.4
*/
public class PolicyInformation {
// Attribute names
/* The policy OID */
/* A Set of java.security.cert.PolicyQualifierInfo objects */
/**
* Create an instance of PolicyInformation
*
* @param policyIdentifier the policyIdentifier as a
* CertificatePolicyId
* @param policyQualifiers a Set of PolicyQualifierInfo objects.
* Must not be NULL. Specify an empty Set for no qualifiers.
* @exception IOException on decoding errors.
*/
if (policyQualifiers == null) {
throw new NullPointerException("policyQualifiers is null");
}
this.policyQualifiers =
this.policyIdentifier = policyIdentifier;
}
/**
* Create an instance of PolicyInformation, decoding from
* the passed DerValue.
*
* @param val the DerValue to construct the PolicyInformation from.
* @exception IOException on decoding errors.
*/
throw new IOException("Invalid encoding of PolicyInformation");
}
throw new IOException("Invalid encoding of PolicyInformation");
throw new IOException("No data available in policyQualifiers");
} else {
}
}
/**
* Compare this PolicyInformation with another object for equality
*
* @param other object to be compared with this
* @return true iff the PolicyInformation objects match
*/
if (!(other instanceof PolicyInformation))
return false;
return false;
}
/**
* Returns the hash code for this PolicyInformation.
*
* @return a hash code value.
*/
public int hashCode() {
return myhash;
}
/**
* Return the policyIdentifier value
*
* @return The CertificatePolicyId object containing
* the policyIdentifier (not a copy).
*/
return policyIdentifier;
}
/**
* Return the policyQualifiers value
*
* @return a Set of PolicyQualifierInfo objects associated
* with this certificate policy (not a copy).
* Returns an empty Set if there are no qualifiers.
* Never returns null.
*/
return policyQualifiers;
}
/**
* Get the attribute value.
*/
return policyIdentifier;
return policyQualifiers;
} else {
"] not recognized by PolicyInformation.");
}
}
/**
* Set the attribute value.
*/
if (obj instanceof CertificatePolicyId)
else
throw new IOException("Attribute value must be instance " +
"of CertificatePolicyId.");
if (policyIdentifier == null) {
throw new IOException("Attribute must have a " +
"CertificatePolicyIdentifier value before " +
"PolicyQualifierInfo can be set.");
}
while (i.hasNext()) {
if (!(obj1 instanceof PolicyQualifierInfo)) {
throw new IOException("Attribute value must be a" +
"Set of PolicyQualifierInfo objects.");
}
}
} else {
throw new IOException("Attribute value must be of type Set.");
}
} else {
"] not recognized by PolicyInformation");
}
}
/**
* Delete the attribute value.
*/
throw new IOException("Attribute ID may not be deleted from " +
"PolicyInformation.");
} else {
//ID may not be deleted
"] not recognized by PolicyInformation.");
}
}
/**
* Return an enumeration of names of attributes existing within this
* attribute.
*/
}
/**
* Return the name of this attribute.
*/
return NAME;
}
/**
* Return a printable representation of the PolicyInformation.
*/
return s.toString();
}
/**
* Write the PolicyInformation to the DerOutputStream.
*
* @param out the DerOutputStream to write the extension to.
* @exception IOException on encoding errors.
*/
if (!policyQualifiers.isEmpty()) {
}
}
}
}