jdk/test/javax/xml/crypto/dsig/X509KeySelector.java
changeset 27747 3a271dc8b758
parent 11674 a657f8ba55fc
equal deleted inserted replaced
27736:8c9bd4be4a86 27747:3a271dc8b758
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   137             if (keyInfo == null || ks.size() == 0) {
   137             if (keyInfo == null || ks.size() == 0) {
   138                 return new SimpleKeySelectorResult(null);
   138                 return new SimpleKeySelectorResult(null);
   139             }
   139             }
   140 
   140 
   141             // Iterate through KeyInfo types
   141             // Iterate through KeyInfo types
   142             Iterator i = keyInfo.getContent().iterator();
   142             for (XMLStructure kiType : keyInfo.getContent()) {
   143             while (i.hasNext()) {
       
   144                 XMLStructure kiType = (XMLStructure) i.next();
       
   145                 // check X509Data
   143                 // check X509Data
   146                 if (kiType instanceof X509Data) {
   144                 if (kiType instanceof X509Data) {
   147                     X509Data xd = (X509Data) kiType;
   145                     X509Data xd = (X509Data) kiType;
   148                     KeySelectorResult ksr = x509DataSelect(xd, sm);
   146                     KeySelectorResult ksr = x509DataSelect(xd, sm);
   149                     if (ksr != null) {
   147                     if (ksr != null) {
   301         } catch (IOException ioe) {
   299         } catch (IOException ioe) {
   302             throw new KeySelectorException(ioe);
   300             throw new KeySelectorException(ioe);
   303         }
   301         }
   304         Collection<X509Certificate> certs = new ArrayList<>();
   302         Collection<X509Certificate> certs = new ArrayList<>();
   305 
   303 
   306         Iterator xi = xd.getContent().iterator();
   304         for (Object o : xd.getContent()) {
   307         while (xi.hasNext()) {
       
   308             Object o = xi.next();
       
   309             // check X509IssuerSerial
   305             // check X509IssuerSerial
   310             if (o instanceof X509IssuerSerial) {
   306             if (o instanceof X509IssuerSerial) {
   311                 X509IssuerSerial xis = (X509IssuerSerial) o;
   307                 X509IssuerSerial xis = (X509IssuerSerial) o;
   312                 try {
   308                 try {
   313                     subjectcs.setSerialNumber(xis.getSerialNumber());
   309                     subjectcs.setSerialNumber(xis.getSerialNumber());