Java Code Examples for sun.security.util.DerValue#resetTag()
The following examples show how to use
sun.security.util.DerValue#resetTag() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DistributionPointName.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Creates a distribution point name from its DER-encoded form. * * @param encoding the DER-encoded value. * @throws IOException on decoding error. */ public DistributionPointName(DerValue encoding) throws IOException { if (encoding.isContextSpecific(TAG_FULL_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(encoding); } else if (encoding.isContextSpecific(TAG_RELATIVE_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Set); relativeName = new RDN(encoding); } else { throw new IOException("Invalid encoding for DistributionPointName"); } }
Example 2
Source File: DistributionPointName.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Creates a distribution point name from its DER-encoded form. * * @param encoding the DER-encoded value. * @throws IOException on decoding error. */ public DistributionPointName(DerValue encoding) throws IOException { if (encoding.isContextSpecific(TAG_FULL_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(encoding); } else if (encoding.isContextSpecific(TAG_RELATIVE_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Set); relativeName = new RDN(encoding); } else { throw new IOException("Invalid encoding for DistributionPointName"); } }
Example 3
Source File: DistributionPointName.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Creates a distribution point name from its DER-encoded form. * * @param encoding the DER-encoded value. * @throws IOException on decoding error. */ public DistributionPointName(DerValue encoding) throws IOException { if (encoding.isContextSpecific(TAG_FULL_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(encoding); } else if (encoding.isContextSpecific(TAG_RELATIVE_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Set); relativeName = new RDN(encoding); } else { throw new IOException("Invalid encoding for DistributionPointName"); } }
Example 4
Source File: DistributionPointName.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Creates a distribution point name from its DER-encoded form. * * @param encoding the DER-encoded value. * @throws IOException on decoding error. */ public DistributionPointName(DerValue encoding) throws IOException { if (encoding.isContextSpecific(TAG_FULL_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(encoding); } else if (encoding.isContextSpecific(TAG_RELATIVE_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Set); relativeName = new RDN(encoding); } else { throw new IOException("Invalid encoding for DistributionPointName"); } }
Example 5
Source File: DistributionPointName.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Creates a distribution point name from its DER-encoded form. * * @param encoding the DER-encoded value. * @throws IOException on decoding error. */ public DistributionPointName(DerValue encoding) throws IOException { if (encoding.isContextSpecific(TAG_FULL_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(encoding); } else if (encoding.isContextSpecific(TAG_RELATIVE_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Set); relativeName = new RDN(encoding); } else { throw new IOException("Invalid encoding for DistributionPointName"); } }
Example 6
Source File: DistributionPointName.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Creates a distribution point name from its DER-encoded form. * * @param encoding the DER-encoded value. * @throws IOException on decoding error. */ public DistributionPointName(DerValue encoding) throws IOException { if (encoding.isContextSpecific(TAG_FULL_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(encoding); } else if (encoding.isContextSpecific(TAG_RELATIVE_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Set); relativeName = new RDN(encoding); } else { throw new IOException("Invalid encoding for DistributionPointName"); } }
Example 7
Source File: DistributionPointName.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Creates a distribution point name from its DER-encoded form. * * @param encoding the DER-encoded value. * @throws IOException on decoding error. */ public DistributionPointName(DerValue encoding) throws IOException { if (encoding.isContextSpecific(TAG_FULL_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(encoding); } else if (encoding.isContextSpecific(TAG_RELATIVE_NAME) && encoding.isConstructed()) { encoding.resetTag(DerValue.tag_Set); relativeName = new RDN(encoding); } else { throw new IOException("Invalid encoding for DistributionPointName"); } }
Example 8
Source File: IssuingDistributionPointExtension.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * 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. */ public IssuingDistributionPointExtension(Boolean critical, Object value) throws IOException { this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id; this.critical = critical.booleanValue(); if (!(value instanceof byte[])) { throw new IOException("Illegal argument type"); } extensionValue = (byte[])value; DerValue val = new DerValue(extensionValue); if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding for " + "IssuingDistributionPointExtension."); } // All the elements in issuingDistributionPoint are optional if ((val.data == null) || (val.data.available() == 0)) { return; } DerInputStream in = val.data; while (in != null && in.available() != 0) { DerValue opt = in.getDerValue(); if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) && opt.isConstructed()) { distributionPoint = new DistributionPointName(opt.data.getDerValue()); } else if (opt.isContextSpecific(TAG_ONLY_USER_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyUserCerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_CA_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyCACerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_SOME_REASONS) && !opt.isConstructed()) { revocationReasons = new ReasonFlags(opt); // expects tag implicit } else if (opt.isContextSpecific(TAG_INDIRECT_CRL) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); isIndirectCRL = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_ATTRIBUTE_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyAttributeCerts = opt.getBoolean(); } else { throw new IOException ("Invalid encoding of IssuingDistributionPoint"); } } }
Example 9
Source File: IssuingDistributionPointExtension.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * 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. */ public IssuingDistributionPointExtension(Boolean critical, Object value) throws IOException { this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id; this.critical = critical.booleanValue(); if (!(value instanceof byte[])) { throw new IOException("Illegal argument type"); } extensionValue = (byte[])value; DerValue val = new DerValue(extensionValue); if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding for " + "IssuingDistributionPointExtension."); } // All the elements in issuingDistributionPoint are optional if ((val.data == null) || (val.data.available() == 0)) { return; } DerInputStream in = val.data; while (in != null && in.available() != 0) { DerValue opt = in.getDerValue(); if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) && opt.isConstructed()) { distributionPoint = new DistributionPointName(opt.data.getDerValue()); } else if (opt.isContextSpecific(TAG_ONLY_USER_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyUserCerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_CA_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyCACerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_SOME_REASONS) && !opt.isConstructed()) { revocationReasons = new ReasonFlags(opt); // expects tag implicit } else if (opt.isContextSpecific(TAG_INDIRECT_CRL) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); isIndirectCRL = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_ATTRIBUTE_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyAttributeCerts = opt.getBoolean(); } else { throw new IOException ("Invalid encoding of IssuingDistributionPoint"); } } }
Example 10
Source File: IssuingDistributionPointExtension.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * 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. */ public IssuingDistributionPointExtension(Boolean critical, Object value) throws IOException { this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id; this.critical = critical.booleanValue(); if (!(value instanceof byte[])) { throw new IOException("Illegal argument type"); } extensionValue = (byte[])value; DerValue val = new DerValue(extensionValue); if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding for " + "IssuingDistributionPointExtension."); } // All the elements in issuingDistributionPoint are optional if ((val.data == null) || (val.data.available() == 0)) { return; } DerInputStream in = val.data; while (in != null && in.available() != 0) { DerValue opt = in.getDerValue(); if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) && opt.isConstructed()) { distributionPoint = new DistributionPointName(opt.data.getDerValue()); } else if (opt.isContextSpecific(TAG_ONLY_USER_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyUserCerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_CA_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyCACerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_SOME_REASONS) && !opt.isConstructed()) { revocationReasons = new ReasonFlags(opt); // expects tag implicit } else if (opt.isContextSpecific(TAG_INDIRECT_CRL) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); isIndirectCRL = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_ATTRIBUTE_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyAttributeCerts = opt.getBoolean(); } else { throw new IOException ("Invalid encoding of IssuingDistributionPoint"); } } }
Example 11
Source File: DistributionPoint.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * Create the object from the passed DER encoded form. * * @param val the DER encoded form of the DistributionPoint * @throws IOException on error */ public DistributionPoint(DerValue val) throws IOException { if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding of DistributionPoint."); } // Note that all the fields in DistributionPoint are defined as // being OPTIONAL, i.e., there could be an empty SEQUENCE, resulting // in val.data being null. while ((val.data != null) && (val.data.available() != 0)) { DerValue opt = val.data.getDerValue(); if (opt.isContextSpecific(TAG_DIST_PT) && opt.isConstructed()) { if ((fullName != null) || (relativeName != null)) { throw new IOException("Duplicate DistributionPointName in " + "DistributionPoint."); } DerValue distPnt = opt.data.getDerValue(); if (distPnt.isContextSpecific(TAG_FULL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(distPnt); } else if (distPnt.isContextSpecific(TAG_REL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Set); relativeName = new RDN(distPnt); } else { throw new IOException("Invalid DistributionPointName in " + "DistributionPoint"); } } else if (opt.isContextSpecific(TAG_REASONS) && !opt.isConstructed()) { if (reasonFlags != null) { throw new IOException("Duplicate Reasons in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_BitString); reasonFlags = (opt.getUnalignedBitString()).toBooleanArray(); } else if (opt.isContextSpecific(TAG_ISSUER) && opt.isConstructed()) { if (crlIssuer != null) { throw new IOException("Duplicate CRLIssuer in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_Sequence); crlIssuer = new GeneralNames(opt); } else { throw new IOException("Invalid encoding of " + "DistributionPoint."); } } if ((crlIssuer == null) && (fullName == null) && (relativeName == null)) { throw new IOException("One of fullName, relativeName, " + " and crlIssuer has to be set"); } }
Example 12
Source File: IssuingDistributionPointExtension.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * 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. */ public IssuingDistributionPointExtension(Boolean critical, Object value) throws IOException { this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id; this.critical = critical.booleanValue(); if (!(value instanceof byte[])) { throw new IOException("Illegal argument type"); } extensionValue = (byte[])value; DerValue val = new DerValue(extensionValue); if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding for " + "IssuingDistributionPointExtension."); } // All the elements in issuingDistributionPoint are optional if ((val.data == null) || (val.data.available() == 0)) { return; } DerInputStream in = val.data; while (in != null && in.available() != 0) { DerValue opt = in.getDerValue(); if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) && opt.isConstructed()) { distributionPoint = new DistributionPointName(opt.data.getDerValue()); } else if (opt.isContextSpecific(TAG_ONLY_USER_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyUserCerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_CA_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyCACerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_SOME_REASONS) && !opt.isConstructed()) { revocationReasons = new ReasonFlags(opt); // expects tag implicit } else if (opt.isContextSpecific(TAG_INDIRECT_CRL) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); isIndirectCRL = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_ATTRIBUTE_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyAttributeCerts = opt.getBoolean(); } else { throw new IOException ("Invalid encoding of IssuingDistributionPoint"); } } }
Example 13
Source File: IssuingDistributionPointExtension.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * 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. */ public IssuingDistributionPointExtension(Boolean critical, Object value) throws IOException { this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id; this.critical = critical.booleanValue(); if (!(value instanceof byte[])) { throw new IOException("Illegal argument type"); } extensionValue = (byte[])value; DerValue val = new DerValue(extensionValue); if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding for " + "IssuingDistributionPointExtension."); } // All the elements in issuingDistributionPoint are optional if ((val.data == null) || (val.data.available() == 0)) { return; } DerInputStream in = val.data; while (in != null && in.available() != 0) { DerValue opt = in.getDerValue(); if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) && opt.isConstructed()) { distributionPoint = new DistributionPointName(opt.data.getDerValue()); } else if (opt.isContextSpecific(TAG_ONLY_USER_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyUserCerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_CA_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyCACerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_SOME_REASONS) && !opt.isConstructed()) { revocationReasons = new ReasonFlags(opt); // expects tag implicit } else if (opt.isContextSpecific(TAG_INDIRECT_CRL) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); isIndirectCRL = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_ATTRIBUTE_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyAttributeCerts = opt.getBoolean(); } else { throw new IOException ("Invalid encoding of IssuingDistributionPoint"); } } }
Example 14
Source File: DistributionPoint.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Create the object from the passed DER encoded form. * * @param val the DER encoded form of the DistributionPoint * @throws IOException on error */ public DistributionPoint(DerValue val) throws IOException { if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding of DistributionPoint."); } // Note that all the fields in DistributionPoint are defined as // being OPTIONAL, i.e., there could be an empty SEQUENCE, resulting // in val.data being null. while ((val.data != null) && (val.data.available() != 0)) { DerValue opt = val.data.getDerValue(); if (opt.isContextSpecific(TAG_DIST_PT) && opt.isConstructed()) { if ((fullName != null) || (relativeName != null)) { throw new IOException("Duplicate DistributionPointName in " + "DistributionPoint."); } DerValue distPnt = opt.data.getDerValue(); if (distPnt.isContextSpecific(TAG_FULL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(distPnt); } else if (distPnt.isContextSpecific(TAG_REL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Set); relativeName = new RDN(distPnt); } else { throw new IOException("Invalid DistributionPointName in " + "DistributionPoint"); } } else if (opt.isContextSpecific(TAG_REASONS) && !opt.isConstructed()) { if (reasonFlags != null) { throw new IOException("Duplicate Reasons in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_BitString); reasonFlags = (opt.getUnalignedBitString()).toBooleanArray(); } else if (opt.isContextSpecific(TAG_ISSUER) && opt.isConstructed()) { if (crlIssuer != null) { throw new IOException("Duplicate CRLIssuer in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_Sequence); crlIssuer = new GeneralNames(opt); } else { throw new IOException("Invalid encoding of " + "DistributionPoint."); } } if ((crlIssuer == null) && (fullName == null) && (relativeName == null)) { throw new IOException("One of fullName, relativeName, " + " and crlIssuer has to be set"); } }
Example 15
Source File: IssuingDistributionPointExtension.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * 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. */ public IssuingDistributionPointExtension(Boolean critical, Object value) throws IOException { this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id; this.critical = critical.booleanValue(); if (!(value instanceof byte[])) { throw new IOException("Illegal argument type"); } extensionValue = (byte[])value; DerValue val = new DerValue(extensionValue); if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding for " + "IssuingDistributionPointExtension."); } // All the elements in issuingDistributionPoint are optional if ((val.data == null) || (val.data.available() == 0)) { return; } DerInputStream in = val.data; while (in != null && in.available() != 0) { DerValue opt = in.getDerValue(); if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) && opt.isConstructed()) { distributionPoint = new DistributionPointName(opt.data.getDerValue()); } else if (opt.isContextSpecific(TAG_ONLY_USER_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyUserCerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_CA_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyCACerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_SOME_REASONS) && !opt.isConstructed()) { revocationReasons = new ReasonFlags(opt); // expects tag implicit } else if (opt.isContextSpecific(TAG_INDIRECT_CRL) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); isIndirectCRL = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_ATTRIBUTE_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyAttributeCerts = opt.getBoolean(); } else { throw new IOException ("Invalid encoding of IssuingDistributionPoint"); } } }
Example 16
Source File: DistributionPoint.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Create the object from the passed DER encoded form. * * @param val the DER encoded form of the DistributionPoint * @throws IOException on error */ public DistributionPoint(DerValue val) throws IOException { if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding of DistributionPoint."); } // Note that all the fields in DistributionPoint are defined as // being OPTIONAL, i.e., there could be an empty SEQUENCE, resulting // in val.data being null. while ((val.data != null) && (val.data.available() != 0)) { DerValue opt = val.data.getDerValue(); if (opt.isContextSpecific(TAG_DIST_PT) && opt.isConstructed()) { if ((fullName != null) || (relativeName != null)) { throw new IOException("Duplicate DistributionPointName in " + "DistributionPoint."); } DerValue distPnt = opt.data.getDerValue(); if (distPnt.isContextSpecific(TAG_FULL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(distPnt); } else if (distPnt.isContextSpecific(TAG_REL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Set); relativeName = new RDN(distPnt); } else { throw new IOException("Invalid DistributionPointName in " + "DistributionPoint"); } } else if (opt.isContextSpecific(TAG_REASONS) && !opt.isConstructed()) { if (reasonFlags != null) { throw new IOException("Duplicate Reasons in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_BitString); reasonFlags = (opt.getUnalignedBitString()).toBooleanArray(); } else if (opt.isContextSpecific(TAG_ISSUER) && opt.isConstructed()) { if (crlIssuer != null) { throw new IOException("Duplicate CRLIssuer in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_Sequence); crlIssuer = new GeneralNames(opt); } else { throw new IOException("Invalid encoding of " + "DistributionPoint."); } } if ((crlIssuer == null) && (fullName == null) && (relativeName == null)) { throw new IOException("One of fullName, relativeName, " + " and crlIssuer has to be set"); } }
Example 17
Source File: DistributionPoint.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Create the object from the passed DER encoded form. * * @param val the DER encoded form of the DistributionPoint * @throws IOException on error */ public DistributionPoint(DerValue val) throws IOException { if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding of DistributionPoint."); } // Note that all the fields in DistributionPoint are defined as // being OPTIONAL, i.e., there could be an empty SEQUENCE, resulting // in val.data being null. while ((val.data != null) && (val.data.available() != 0)) { DerValue opt = val.data.getDerValue(); if (opt.isContextSpecific(TAG_DIST_PT) && opt.isConstructed()) { if ((fullName != null) || (relativeName != null)) { throw new IOException("Duplicate DistributionPointName in " + "DistributionPoint."); } DerValue distPnt = opt.data.getDerValue(); if (distPnt.isContextSpecific(TAG_FULL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(distPnt); } else if (distPnt.isContextSpecific(TAG_REL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Set); relativeName = new RDN(distPnt); } else { throw new IOException("Invalid DistributionPointName in " + "DistributionPoint"); } } else if (opt.isContextSpecific(TAG_REASONS) && !opt.isConstructed()) { if (reasonFlags != null) { throw new IOException("Duplicate Reasons in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_BitString); reasonFlags = (opt.getUnalignedBitString()).toBooleanArray(); } else if (opt.isContextSpecific(TAG_ISSUER) && opt.isConstructed()) { if (crlIssuer != null) { throw new IOException("Duplicate CRLIssuer in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_Sequence); crlIssuer = new GeneralNames(opt); } else { throw new IOException("Invalid encoding of " + "DistributionPoint."); } } if ((crlIssuer == null) && (fullName == null) && (relativeName == null)) { throw new IOException("One of fullName, relativeName, " + " and crlIssuer has to be set"); } }
Example 18
Source File: IssuingDistributionPointExtension.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * 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. */ public IssuingDistributionPointExtension(Boolean critical, Object value) throws IOException { this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id; this.critical = critical.booleanValue(); if (!(value instanceof byte[])) { throw new IOException("Illegal argument type"); } extensionValue = (byte[])value; DerValue val = new DerValue(extensionValue); if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding for " + "IssuingDistributionPointExtension."); } // All the elements in issuingDistributionPoint are optional if ((val.data == null) || (val.data.available() == 0)) { return; } DerInputStream in = val.data; while (in != null && in.available() != 0) { DerValue opt = in.getDerValue(); if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) && opt.isConstructed()) { distributionPoint = new DistributionPointName(opt.data.getDerValue()); } else if (opt.isContextSpecific(TAG_ONLY_USER_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyUserCerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_CA_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyCACerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_SOME_REASONS) && !opt.isConstructed()) { revocationReasons = new ReasonFlags(opt); // expects tag implicit } else if (opt.isContextSpecific(TAG_INDIRECT_CRL) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); isIndirectCRL = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_ATTRIBUTE_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyAttributeCerts = opt.getBoolean(); } else { throw new IOException ("Invalid encoding of IssuingDistributionPoint"); } } }
Example 19
Source File: DistributionPoint.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Create the object from the passed DER encoded form. * * @param val the DER encoded form of the DistributionPoint * @throws IOException on error */ public DistributionPoint(DerValue val) throws IOException { if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding of DistributionPoint."); } // Note that all the fields in DistributionPoint are defined as // being OPTIONAL, i.e., there could be an empty SEQUENCE, resulting // in val.data being null. while ((val.data != null) && (val.data.available() != 0)) { DerValue opt = val.data.getDerValue(); if (opt.isContextSpecific(TAG_DIST_PT) && opt.isConstructed()) { if ((fullName != null) || (relativeName != null)) { throw new IOException("Duplicate DistributionPointName in " + "DistributionPoint."); } DerValue distPnt = opt.data.getDerValue(); if (distPnt.isContextSpecific(TAG_FULL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Sequence); fullName = new GeneralNames(distPnt); } else if (distPnt.isContextSpecific(TAG_REL_NAME) && distPnt.isConstructed()) { distPnt.resetTag(DerValue.tag_Set); relativeName = new RDN(distPnt); } else { throw new IOException("Invalid DistributionPointName in " + "DistributionPoint"); } } else if (opt.isContextSpecific(TAG_REASONS) && !opt.isConstructed()) { if (reasonFlags != null) { throw new IOException("Duplicate Reasons in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_BitString); reasonFlags = (opt.getUnalignedBitString()).toBooleanArray(); } else if (opt.isContextSpecific(TAG_ISSUER) && opt.isConstructed()) { if (crlIssuer != null) { throw new IOException("Duplicate CRLIssuer in " + "DistributionPoint."); } opt.resetTag(DerValue.tag_Sequence); crlIssuer = new GeneralNames(opt); } else { throw new IOException("Invalid encoding of " + "DistributionPoint."); } } if ((crlIssuer == null) && (fullName == null) && (relativeName == null)) { throw new IOException("One of fullName, relativeName, " + " and crlIssuer has to be set"); } }
Example 20
Source File: IssuingDistributionPointExtension.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * 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. */ public IssuingDistributionPointExtension(Boolean critical, Object value) throws IOException { this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id; this.critical = critical.booleanValue(); if (!(value instanceof byte[])) { throw new IOException("Illegal argument type"); } extensionValue = (byte[])value; DerValue val = new DerValue(extensionValue); if (val.tag != DerValue.tag_Sequence) { throw new IOException("Invalid encoding for " + "IssuingDistributionPointExtension."); } // All the elements in issuingDistributionPoint are optional if ((val.data == null) || (val.data.available() == 0)) { return; } DerInputStream in = val.data; while (in != null && in.available() != 0) { DerValue opt = in.getDerValue(); if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) && opt.isConstructed()) { distributionPoint = new DistributionPointName(opt.data.getDerValue()); } else if (opt.isContextSpecific(TAG_ONLY_USER_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyUserCerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_CA_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyCACerts = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_SOME_REASONS) && !opt.isConstructed()) { revocationReasons = new ReasonFlags(opt); // expects tag implicit } else if (opt.isContextSpecific(TAG_INDIRECT_CRL) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); isIndirectCRL = opt.getBoolean(); } else if (opt.isContextSpecific(TAG_ONLY_ATTRIBUTE_CERTS) && !opt.isConstructed()) { opt.resetTag(DerValue.tag_Boolean); hasOnlyAttributeCerts = opt.getBoolean(); } else { throw new IOException ("Invalid encoding of IssuingDistributionPoint"); } } }