Java 类java.security.cert.PolicyQualifierInfo 实例源码

项目:OpenJSharp    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:jdk8u-jdk    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:openjdk-jdk10    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:openjdk9    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:jdk8u_jdk    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:javify    文件:CertificatePolicies.java   
public CertificatePolicies (final List<OID> policies,
                            final Map<OID, List<PolicyQualifierInfo>> policyQualifierInfos)
{
  for (Iterator it = policies.iterator(); it.hasNext(); )
    if (!(it.next() instanceof OID))
      throw new IllegalArgumentException ("policies must be OIDs");
  for (Iterator it = policyQualifierInfos.entrySet().iterator(); it.hasNext();)
    {
      Map.Entry e = (Map.Entry) it.next();
      if (!(e.getKey() instanceof OID) || !policies.contains (e.getKey()))
        throw new IllegalArgumentException
          ("policyQualifierInfos keys must be OIDs");
      if (!(e.getValue() instanceof List))
        throw new IllegalArgumentException
          ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
      for (Iterator it2 = ((List) e.getValue()).iterator(); it.hasNext(); )
        if (!(it2.next() instanceof PolicyQualifierInfo))
          throw new IllegalArgumentException
            ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
    }
  this.policies = Collections.unmodifiableList (new ArrayList<OID>(policies));
  this.policyQualifierInfos = Collections.unmodifiableMap
    (new HashMap<OID, List<PolicyQualifierInfo>>(policyQualifierInfos));
}
项目:jvm-stm    文件:CertificatePolicies.java   
public CertificatePolicies (final List<OID> policies,
                            final Map<OID, List<PolicyQualifierInfo>> policyQualifierInfos)
{
  for (Iterator it = policies.iterator(); it.hasNext(); )
    if (!(it.next() instanceof OID))
      throw new IllegalArgumentException ("policies must be OIDs");
  for (Iterator it = policyQualifierInfos.entrySet().iterator(); it.hasNext();)
    {
      Map.Entry e = (Map.Entry) it.next();
      if (!(e.getKey() instanceof OID) || !policies.contains (e.getKey()))
        throw new IllegalArgumentException
          ("policyQualifierInfos keys must be OIDs");
      if (!(e.getValue() instanceof List))
        throw new IllegalArgumentException
          ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
      for (Iterator it2 = ((List) e.getValue()).iterator(); it.hasNext(); )
        if (!(it2.next() instanceof PolicyQualifierInfo))
          throw new IllegalArgumentException
            ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
    }
  this.policies = Collections.unmodifiableList (new ArrayList<OID>(policies));
  this.policyQualifierInfos = Collections.unmodifiableMap
    (new HashMap<OID, List<PolicyQualifierInfo>>(policyQualifierInfos));
}
项目:infobip-open-jdk-8    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:jdk8u-dev-jdk    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:In-the-Box-Fork    文件:PolicyQualifierInfoTest.java   
/**
 * Test #4 for <code>PolicyQualifierInfo</code> constructor<br>
 * Assertion: The encoded byte array is copied on construction
 *
 * @throws IOException
 */
@TestTargetNew(
    level = TestLevel.PARTIAL_COMPLETE,
    notes = "Verifies constructor with encoded byte array copied on construction.",
    method = "PolicyQualifierInfo",
    args = {byte[].class}
)
public final void testPolicyQualifierInfo04() throws IOException  {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    byte[] encodingCopy = encoding.clone();
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encodingCopy);
    // get encoding
    byte[] encodingRet = i.getEncoded();
    // check returned array
    assertTrue(Arrays.equals(encoding, encodingRet));
    // modify input
    encodingCopy[0] = (byte)0;
    // get encoding again
    byte[] encodingRet1 = i.getEncoded();
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(encoding, encodingRet1));
}
项目:In-the-Box-Fork    文件:PolicyQualifierInfoTest.java   
/**
 * Test #1 for <code>getEncoded()</code> method
 * Assertion: Returns the ASN.1 DER encoded form of
 * this <code>PolicyQualifierInfo</code>
 *
 * @throws IOException
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getEncoded",
    args = {}
)
public final void testGetEncoded01() throws IOException {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encoding);
    // get encoding
    byte[] encodingRet = i.getEncoded();
    // check returned array
    assertTrue(Arrays.equals(encoding, encodingRet));
}
项目:In-the-Box-Fork    文件:PolicyQualifierInfoTest.java   
/**
 * Test #2 for <code>getEncoded()</code> method
 * Assertion: a copy is returned each time
 *
 * @throws IOException
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getEncoded",
    args = {}
)
public final void testGetEncoded02() throws IOException {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    byte[] encodingCopy = encoding.clone();
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encodingCopy);
    // get encoding
    byte[] encodingRet = i.getEncoded();
    // modify returned array
    encodingRet[0] = (byte)0;
    // get encoding again
    byte[] encodingRet1 = i.getEncoded();
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(encoding, encodingRet1));
}
项目:In-the-Box-Fork    文件:PolicyQualifierInfoTest.java   
/**
 * Test #1 for <code>getPolicyQualifier()</code> method
 * Assertion: Returns the ASN.1 DER encoded form of
 * this <code>PolicyQualifierInfo</code>
 *
 * @throws IOException
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getPolicyQualifier",
    args = {}
)
public final void testGetPolicyQualifier01() throws IOException {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    // get policy qualifier encoding
    byte[] pqEncoding = new byte[28];
    System.arraycopy(encoding, 12, pqEncoding, 0, pqEncoding.length);
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encoding);
    // get encoding
    byte[] pqEncodingRet = i.getPolicyQualifier();
    // check returned array
    assertTrue(Arrays.equals(pqEncoding, pqEncodingRet));
}
项目:jdk7-jdk    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:openjdk-source-code-learn    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:OLD-OpenJDK8    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:cn1    文件:PolicyQualifierInfoTest.java   
/**
 * Test #4 for <code>PolicyQualifierInfo</code> constructor<br>
 * Assertion: The encoded byte array is copied on construction
 * 
 * @throws IOException
 */
public final void testPolicyQualifierInfo04() throws IOException  {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    byte[] encodingCopy = encoding.clone();
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encodingCopy);
    // get encoding
    byte[] encodingRet = i.getEncoded();
    // check returned array
    assertTrue(Arrays.equals(encoding, encodingRet));
    // modify input
    encodingCopy[0] = (byte)0;
    // get encoding again
    byte[] encodingRet1 = i.getEncoded();
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(encoding, encodingRet1));
}
项目:cn1    文件:PolicyQualifierInfoTest.java   
/**
 * Test #2 for <code>getEncoded()</code> method
 * Assertion: a copy is returned each time
 * 
 * @throws IOException
 */
public final void testGetEncoded02() throws IOException {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    byte[] encodingCopy = encoding.clone();
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encodingCopy);
    // get encoding
    byte[] encodingRet = i.getEncoded();
    // modify returned array
    encodingRet[0] = (byte)0;
    // get encoding again
    byte[] encodingRet1 = i.getEncoded();
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(encoding, encodingRet1));
}
项目:cn1    文件:PolicyQualifierInfoTest.java   
/**
 * Test #2 for <code>getPolicyQualifier()</code> method
 * Assertion: a copy is returned each time
 * 
 * @throws IOException
 */
public final void testGetPolicyQualifier02() throws IOException {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    // get policy qualifier encoding
    byte[] pqEncoding = new byte[28];
    System.arraycopy(encoding, 12, pqEncoding, 0, pqEncoding.length);
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encoding);
    // get encoding
    byte[] pqEncodingRet = i.getPolicyQualifier();
    // modify returned array
    pqEncodingRet[0] = (byte)0;
    // get encoding again
    byte[] pqEncodingRet1 = i.getPolicyQualifier();
    //
    assertNotSame(pqEncodingRet, pqEncodingRet1);
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(pqEncoding, pqEncodingRet1));
}
项目:JamVM-PH    文件:CertificatePolicies.java   
public CertificatePolicies (final List<OID> policies,
                            final Map<OID, List<PolicyQualifierInfo>> policyQualifierInfos)
{
  for (Iterator it = policies.iterator(); it.hasNext(); )
    if (!(it.next() instanceof OID))
      throw new IllegalArgumentException ("policies must be OIDs");
  for (Iterator it = policyQualifierInfos.entrySet().iterator(); it.hasNext();)
    {
      Map.Entry e = (Map.Entry) it.next();
      if (!(e.getKey() instanceof OID) || !policies.contains (e.getKey()))
        throw new IllegalArgumentException
          ("policyQualifierInfos keys must be OIDs");
      if (!(e.getValue() instanceof List))
        throw new IllegalArgumentException
          ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
      for (Iterator it2 = ((List) e.getValue()).iterator(); it.hasNext(); )
        if (!(it2.next() instanceof PolicyQualifierInfo))
          throw new IllegalArgumentException
            ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
    }
  this.policies = Collections.unmodifiableList (new ArrayList<OID>(policies));
  this.policyQualifierInfos = Collections.unmodifiableMap
    (new HashMap<OID, List<PolicyQualifierInfo>>(policyQualifierInfos));
}
项目:openjdk-jdk7u-jdk    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:classpath    文件:CertificatePolicies.java   
public CertificatePolicies (final List<OID> policies,
                            final Map<OID, List<PolicyQualifierInfo>> policyQualifierInfos)
{
  for (Iterator it = policies.iterator(); it.hasNext(); )
    if (!(it.next() instanceof OID))
      throw new IllegalArgumentException ("policies must be OIDs");
  for (Iterator it = policyQualifierInfos.entrySet().iterator(); it.hasNext();)
    {
      Map.Entry e = (Map.Entry) it.next();
      if (!(e.getKey() instanceof OID) || !policies.contains (e.getKey()))
        throw new IllegalArgumentException
          ("policyQualifierInfos keys must be OIDs");
      if (!(e.getValue() instanceof List))
        throw new IllegalArgumentException
          ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
      for (Iterator it2 = ((List) e.getValue()).iterator(); it.hasNext(); )
        if (!(it2.next() instanceof PolicyQualifierInfo))
          throw new IllegalArgumentException
            ("policyQualifierInfos values must be Lists of PolicyQualifierInfos");
    }
  this.policies = Collections.unmodifiableList (new ArrayList<OID>(policies));
  this.policyQualifierInfos = Collections.unmodifiableMap
    (new HashMap<OID, List<PolicyQualifierInfo>>(policyQualifierInfos));
}
项目:freeVM    文件:PolicyQualifierInfoTest.java   
/**
 * Test #4 for <code>PolicyQualifierInfo</code> constructor<br>
 * Assertion: The encoded byte array is copied on construction
 * 
 * @throws IOException
 */
public final void testPolicyQualifierInfo04() throws IOException  {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    byte[] encodingCopy = encoding.clone();
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encodingCopy);
    // get encoding
    byte[] encodingRet = i.getEncoded();
    // check returned array
    assertTrue(Arrays.equals(encoding, encodingRet));
    // modify input
    encodingCopy[0] = (byte)0;
    // get encoding again
    byte[] encodingRet1 = i.getEncoded();
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(encoding, encodingRet1));
}
项目:freeVM    文件:PolicyQualifierInfoTest.java   
/**
 * Test #2 for <code>getEncoded()</code> method
 * Assertion: a copy is returned each time
 * 
 * @throws IOException
 */
public final void testGetEncoded02() throws IOException {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    byte[] encodingCopy = encoding.clone();
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encodingCopy);
    // get encoding
    byte[] encodingRet = i.getEncoded();
    // modify returned array
    encodingRet[0] = (byte)0;
    // get encoding again
    byte[] encodingRet1 = i.getEncoded();
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(encoding, encodingRet1));
}
项目:freeVM    文件:PolicyQualifierInfoTest.java   
/**
 * Test #2 for <code>getPolicyQualifier()</code> method
 * Assertion: a copy is returned each time
 * 
 * @throws IOException
 */
public final void testGetPolicyQualifier02() throws IOException {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    // get policy qualifier encoding
    byte[] pqEncoding = new byte[28];
    System.arraycopy(encoding, 12, pqEncoding, 0, pqEncoding.length);
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encoding);
    // get encoding
    byte[] pqEncodingRet = i.getPolicyQualifier();
    // modify returned array
    pqEncodingRet[0] = (byte)0;
    // get encoding again
    byte[] pqEncodingRet1 = i.getPolicyQualifier();
    //
    assertNotSame(pqEncodingRet, pqEncodingRet1);
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(pqEncoding, pqEncodingRet1));
}
项目:freeVM    文件:PolicyQualifierInfoTest.java   
/**
 * Test #4 for <code>PolicyQualifierInfo</code> constructor<br>
 * Assertion: The encoded byte array is copied on construction
 * 
 * @throws IOException
 */
public final void testPolicyQualifierInfo04() throws IOException  {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    byte[] encodingCopy = encoding.clone();
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encodingCopy);
    // get encoding
    byte[] encodingRet = i.getEncoded();
    // check returned array
    assertTrue(Arrays.equals(encoding, encodingRet));
    // modify input
    encodingCopy[0] = (byte)0;
    // get encoding again
    byte[] encodingRet1 = i.getEncoded();
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(encoding, encodingRet1));
}
项目:freeVM    文件:PolicyQualifierInfoTest.java   
/**
 * Test #2 for <code>getEncoded()</code> method
 * Assertion: a copy is returned each time
 * 
 * @throws IOException
 */
public final void testGetEncoded02() throws IOException {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    byte[] encodingCopy = encoding.clone();
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encodingCopy);
    // get encoding
    byte[] encodingRet = i.getEncoded();
    // modify returned array
    encodingRet[0] = (byte)0;
    // get encoding again
    byte[] encodingRet1 = i.getEncoded();
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(encoding, encodingRet1));
}
项目:freeVM    文件:PolicyQualifierInfoTest.java   
/**
 * Test #2 for <code>getPolicyQualifier()</code> method
 * Assertion: a copy is returned each time
 * 
 * @throws IOException
 */
public final void testGetPolicyQualifier02() throws IOException {
    // get valid encoding
    byte[] encoding = getDerEncoding();
    // get policy qualifier encoding
    byte[] pqEncoding = new byte[28];
    System.arraycopy(encoding, 12, pqEncoding, 0, pqEncoding.length);
    // pass valid array
    PolicyQualifierInfo i = new PolicyQualifierInfo(encoding);
    // get encoding
    byte[] pqEncodingRet = i.getPolicyQualifier();
    // modify returned array
    pqEncodingRet[0] = (byte)0;
    // get encoding again
    byte[] pqEncodingRet1 = i.getPolicyQualifier();
    //
    assertNotSame(pqEncodingRet, pqEncodingRet1);
    // check that above modification did not change
    // internal state of the PolicyQualifierInfo instance
    assertTrue(Arrays.equals(pqEncoding, pqEncodingRet1));
}
项目:openjdk-icedtea7    文件:PolicyInformation.java   
/**
 * Create an instance of PolicyInformation, decoding from
 * the passed DerValue.
 *
 * @param val the DerValue to construct the PolicyInformation from.
 * @exception IOException on decoding errors.
 */
public PolicyInformation(DerValue val) throws IOException {
    if (val.tag != DerValue.tag_Sequence) {
        throw new IOException("Invalid encoding of PolicyInformation");
    }
    policyIdentifier = new CertificatePolicyId(val.data.getDerValue());
    if (val.data.available() != 0) {
        policyQualifiers = new LinkedHashSet<PolicyQualifierInfo>();
        DerValue opt = val.data.getDerValue();
        if (opt.tag != DerValue.tag_Sequence)
            throw new IOException("Invalid encoding of PolicyInformation");
        if (opt.data.available() == 0)
            throw new IOException("No data available in policyQualifiers");
        while (opt.data.available() != 0)
            policyQualifiers.add(new PolicyQualifierInfo
                    (opt.data.getDerValue().toByteArray()));
    } else {
        policyQualifiers = Collections.emptySet();
    }
}
项目:ipack    文件:CertPathValidatorUtilities.java   
protected static final Set getQualifierSet(ASN1Sequence qualifiers)
    throws CertPathValidatorException
{
    Set pq = new HashSet();

    if (qualifiers == null)
    {
        return pq;
    }

    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    ASN1OutputStream aOut = new ASN1OutputStream(bOut);

    Enumeration e = qualifiers.getObjects();

    while (e.hasMoreElements())
    {
        try
        {
            aOut.writeObject((ASN1Encodable)e.nextElement());

            pq.add(new PolicyQualifierInfo(bOut.toByteArray()));
        }
        catch (IOException ex)
        {
            throw new ExtCertPathValidatorException("Policy qualifier info cannot be decoded.", ex);
        }

        bOut.reset();
    }

    return pq;
}
项目:OpenJSharp    文件:PolicyInformation.java   
/**
 * 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.
 */
public PolicyInformation(CertificatePolicyId policyIdentifier,
        Set<PolicyQualifierInfo> policyQualifiers) throws IOException {
    if (policyQualifiers == null) {
        throw new NullPointerException("policyQualifiers is null");
    }
    this.policyQualifiers =
        new LinkedHashSet<PolicyQualifierInfo>(policyQualifiers);
    this.policyIdentifier = policyIdentifier;
}
项目:OpenJSharp    文件:PolicyInformation.java   
/**
 * Set the attribute value.
 */
@SuppressWarnings("unchecked") // Checked with instanceof
public void set(String name, Object obj) throws IOException {
    if (name.equalsIgnoreCase(ID)) {
        if (obj instanceof CertificatePolicyId)
            policyIdentifier = (CertificatePolicyId)obj;
        else
            throw new IOException("Attribute value must be instance " +
                "of CertificatePolicyId.");
    } else if (name.equalsIgnoreCase(QUALIFIERS)) {
        if (policyIdentifier == null) {
            throw new IOException("Attribute must have a " +
                "CertificatePolicyIdentifier value before " +
                "PolicyQualifierInfo can be set.");
        }
        if (obj instanceof Set) {
            Iterator<?> i = ((Set<?>)obj).iterator();
            while (i.hasNext()) {
                Object obj1 = i.next();
                if (!(obj1 instanceof PolicyQualifierInfo)) {
                    throw new IOException("Attribute value must be a" +
                                "Set of PolicyQualifierInfo objects.");
                }
            }
            policyQualifiers = (Set<PolicyQualifierInfo>) obj;
        } else {
            throw new IOException("Attribute value must be of type Set.");
        }
    } else {
        throw new IOException("Attribute name [" + name +
            "] not recognized by PolicyInformation");
    }
}
项目:OpenJSharp    文件:PolicyInformation.java   
/**
 * Write the PolicyInformation to the DerOutputStream.
 *
 * @param out the DerOutputStream to write the extension to.
 * @exception IOException on encoding errors.
 */
public void encode(DerOutputStream out) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    policyIdentifier.encode(tmp);
    if (!policyQualifiers.isEmpty()) {
        DerOutputStream tmp2 = new DerOutputStream();
        for (PolicyQualifierInfo pq : policyQualifiers) {
            tmp2.write(pq.getEncoded());
        }
        tmp.write(DerValue.tag_Sequence, tmp2);
    }
    out.write(DerValue.tag_Sequence, tmp);
}
项目:jdk8u-jdk    文件:PolicyInformation.java   
/**
 * 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.
 */
public PolicyInformation(CertificatePolicyId policyIdentifier,
        Set<PolicyQualifierInfo> policyQualifiers) throws IOException {
    if (policyQualifiers == null) {
        throw new NullPointerException("policyQualifiers is null");
    }
    this.policyQualifiers =
        new LinkedHashSet<PolicyQualifierInfo>(policyQualifiers);
    this.policyIdentifier = policyIdentifier;
}
项目:jdk8u-jdk    文件:PolicyInformation.java   
/**
 * Set the attribute value.
 */
@SuppressWarnings("unchecked") // Checked with instanceof
public void set(String name, Object obj) throws IOException {
    if (name.equalsIgnoreCase(ID)) {
        if (obj instanceof CertificatePolicyId)
            policyIdentifier = (CertificatePolicyId)obj;
        else
            throw new IOException("Attribute value must be instance " +
                "of CertificatePolicyId.");
    } else if (name.equalsIgnoreCase(QUALIFIERS)) {
        if (policyIdentifier == null) {
            throw new IOException("Attribute must have a " +
                "CertificatePolicyIdentifier value before " +
                "PolicyQualifierInfo can be set.");
        }
        if (obj instanceof Set) {
            Iterator<?> i = ((Set<?>)obj).iterator();
            while (i.hasNext()) {
                Object obj1 = i.next();
                if (!(obj1 instanceof PolicyQualifierInfo)) {
                    throw new IOException("Attribute value must be a" +
                                "Set of PolicyQualifierInfo objects.");
                }
            }
            policyQualifiers = (Set<PolicyQualifierInfo>) obj;
        } else {
            throw new IOException("Attribute value must be of type Set.");
        }
    } else {
        throw new IOException("Attribute name [" + name +
            "] not recognized by PolicyInformation");
    }
}
项目:jdk8u-jdk    文件:PolicyInformation.java   
/**
 * Write the PolicyInformation to the DerOutputStream.
 *
 * @param out the DerOutputStream to write the extension to.
 * @exception IOException on encoding errors.
 */
public void encode(DerOutputStream out) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    policyIdentifier.encode(tmp);
    if (!policyQualifiers.isEmpty()) {
        DerOutputStream tmp2 = new DerOutputStream();
        for (PolicyQualifierInfo pq : policyQualifiers) {
            tmp2.write(pq.getEncoded());
        }
        tmp.write(DerValue.tag_Sequence, tmp2);
    }
    out.write(DerValue.tag_Sequence, tmp);
}
项目:openjdk-jdk10    文件:PolicyInformation.java   
/**
 * 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.
 */
public PolicyInformation(CertificatePolicyId policyIdentifier,
        Set<PolicyQualifierInfo> policyQualifiers) throws IOException {
    if (policyQualifiers == null) {
        throw new NullPointerException("policyQualifiers is null");
    }
    this.policyQualifiers =
        new LinkedHashSet<PolicyQualifierInfo>(policyQualifiers);
    this.policyIdentifier = policyIdentifier;
}
项目:openjdk-jdk10    文件:PolicyInformation.java   
/**
 * Set the attribute value.
 */
@SuppressWarnings("unchecked") // Checked with instanceof
public void set(String name, Object obj) throws IOException {
    if (name.equalsIgnoreCase(ID)) {
        if (obj instanceof CertificatePolicyId)
            policyIdentifier = (CertificatePolicyId)obj;
        else
            throw new IOException("Attribute value must be instance " +
                "of CertificatePolicyId.");
    } else if (name.equalsIgnoreCase(QUALIFIERS)) {
        if (policyIdentifier == null) {
            throw new IOException("Attribute must have a " +
                "CertificatePolicyIdentifier value before " +
                "PolicyQualifierInfo can be set.");
        }
        if (obj instanceof Set) {
            Iterator<?> i = ((Set<?>)obj).iterator();
            while (i.hasNext()) {
                Object obj1 = i.next();
                if (!(obj1 instanceof PolicyQualifierInfo)) {
                    throw new IOException("Attribute value must be a" +
                                "Set of PolicyQualifierInfo objects.");
                }
            }
            policyQualifiers = (Set<PolicyQualifierInfo>) obj;
        } else {
            throw new IOException("Attribute value must be of type Set.");
        }
    } else {
        throw new IOException("Attribute name [" + name +
            "] not recognized by PolicyInformation");
    }
}
项目:openjdk-jdk10    文件:PolicyInformation.java   
/**
 * Write the PolicyInformation to the DerOutputStream.
 *
 * @param out the DerOutputStream to write the extension to.
 * @exception IOException on encoding errors.
 */
public void encode(DerOutputStream out) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    policyIdentifier.encode(tmp);
    if (!policyQualifiers.isEmpty()) {
        DerOutputStream tmp2 = new DerOutputStream();
        for (PolicyQualifierInfo pq : policyQualifiers) {
            tmp2.write(pq.getEncoded());
        }
        tmp.write(DerValue.tag_Sequence, tmp2);
    }
    out.write(DerValue.tag_Sequence, tmp);
}