docs: @Override
      public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose,
                                      AlgorithmMethod method, XMLCryptoContext context)
                      throws KeySelectorException {
          KeySelectorResult result = null;
  
          // The purpose for the key is not to verify a signature.
          if (!purpose.equals(KeySelector.Purpose.VERIFY))
              throw new KeySelectorException("Key purpose not set to \"verify\"");
  
          X509Data x509Data = null;
          X509Certificate cert = null;
  
          // Scans through elements contained in KeyInfo until X509Data 
          // found
          @SuppressWarnings("unchecked")
          List<XMLStructure> content = keyInfo.getContent();
          Iterator<XMLStructure> keyInfoIterator = content.iterator();
          while (keyInfoIterator.hasNext() && x509Data == null) {
  
              // Gets next element within KeyInfo
              XMLStructure xmlStruct = keyInfoIterator.next();
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(tc, "select():  xmlStruct = " + xmlStruct);
  
              // X509Data element found
              if (xmlStruct instanceof X509Data) {
  
                  // Scans through elements contained in X509Data until 
                  // X509Certificate found
                  x509Data = (X509Data) xmlStruct;
                  List<?> x509content = x509Data.getContent();
                  Iterator<?> x509DataIterator = x509content.iterator();
                  while (x509DataIterator.hasNext() && result == null) {
  
                      // Gets next element within X509Data
                      Object obj = x509DataIterator.next();
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                          Tr.debug(tc, "select():  obj = " + obj);
  
                      // X509Certificate found
                      if (obj instanceof X509Certificate) {
  
                          // Gets public key from certificate
                          cert = (X509Certificate) obj;
                          final PublicKey publicKey = cert.getPublicKey();
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                              Tr.debug(tc, "select():  publicKey = " + publicKey);
  
                          // Gets the requested algorithm method
                          String algURI = method.getAlgorithm();
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                              Tr.debug(tc, "select():  algURI = " + algURI);
  
                          // Gets the public key algorithm
                          String algName = publicKey.getAlgorithm();
                          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                              Tr.debug(tc, "select():  algName = " + algName);
  
                          // Public key algorithm matches requested algorithm method
                          if ((algName.equalsIgnoreCase("DSA") &&
                              algURI.equalsIgnoreCase(SignatureMethod.DSA_SHA1)) ||
                              (algName.equalsIgnoreCase("RSA") &&
                              algURI.equalsIgnoreCase(SignatureMethod.RSA_SHA1)))
                              result = new ConfigKeySelectorResult(publicKey);
                      }
                  }
              }
          }
  
          // The key to verify the signature was not found
          if (result == null)
              result = new ConfigKeySelectorResult(null);
  
          return result;
      }