Package org.apache.xml.security.keys.keyresolver

Examples of org.apache.xml.security.keys.keyresolver.KeyResolverException


                SecretKey key = keyFactory.generateSecret(keySpec);

                return key;
            }
            catch (Exception e) {
                throw new KeyResolverException("Something badly wrong in creation of bob's key");
            }
        }

        return null;
    }
View Full Code Here


        }

        try {
            if (storage == null) {
                Object exArgs[] = { Constants._TAG_X509SUBJECTNAME };
                KeyResolverException ex =
                    new KeyResolverException("KeyResolver.needStorageResolver", exArgs);

                if (log.isDebugEnabled()) {
                    log.debug("", ex);
                }

                throw ex;
            }

            x509childObject = new XMLX509SubjectName[x509childNodes.length];

            for (int i = 0; i < x509childNodes.length; i++) {
                x509childObject[i] = new XMLX509SubjectName(x509childNodes[i], BaseURI);
            }

            Iterator<Certificate> storageIterator = storage.getIterator();
            while (storageIterator.hasNext()) {
                X509Certificate cert = (X509Certificate)storageIterator.next();
                XMLX509SubjectName certSN =
                    new XMLX509SubjectName(element.getOwnerDocument(), cert);

                if (log.isDebugEnabled()) {
                    log.debug("Found Certificate SN: " + certSN.getSubjectName());
                }

                for (int i = 0; i < x509childObject.length; i++) {
                    if (log.isDebugEnabled()) {
                        log.debug("Found Element SN:     "
                              + x509childObject[i].getSubjectName());
                    }

                    if (certSN.equals(x509childObject[i])) {
                        if (log.isDebugEnabled()) {
                            log.debug("match !!! ");
                        }

                        return cert;
                    }
                    if (log.isDebugEnabled()) {
                        log.debug("no match...");
                    }
                }
            }

            return null;
        } catch (XMLSecurityException ex) {
            if (log.isDebugEnabled()) {
                log.debug("XMLSecurityException", ex);
            }

            throw new KeyResolverException("generic.EmptyMessage", ex);
        }
    }
View Full Code Here

            return null;
        }
        try {
            if (storage == null) {
                Object exArgs[] = { Constants._TAG_X509ISSUERSERIAL };
                KeyResolverException ex =
                    new KeyResolverException("KeyResolver.needStorageResolver", exArgs);

                if (log.isDebugEnabled()) {
                    log.debug("", ex);
                }
                throw ex;
            }

            int noOfISS = x509data.lengthIssuerSerial();

            Iterator<Certificate> storageIterator = storage.getIterator();
            while (storageIterator.hasNext()) {
                X509Certificate cert = (X509Certificate)storageIterator.next();
                XMLX509IssuerSerial certSerial = new XMLX509IssuerSerial(element.getOwnerDocument(), cert);

                if (log.isDebugEnabled()) {
                    log.debug("Found Certificate Issuer: " + certSerial.getIssuerName());
                    log.debug("Found Certificate Serial: " + certSerial.getSerialNumber().toString());
                }

                for (int i = 0; i < noOfISS; i++) {
                    XMLX509IssuerSerial xmliss = x509data.itemIssuerSerial(i);

                    if (log.isDebugEnabled()) {
                        log.debug("Found Element Issuer:     "
                                  + xmliss.getIssuerName());
                        log.debug("Found Element Serial:     "
                                  + xmliss.getSerialNumber().toString());
                    }

                    if (certSerial.equals(xmliss)) {
                        if (log.isDebugEnabled()) {
                            log.debug("match !!! ");
                        }
                        return cert;
                    }
                    if (log.isDebugEnabled()) {
                        log.debug("no match...");
                    }
                }
            }

            return null;
        } catch (XMLSecurityException ex) {
            if (log.isDebugEnabled()) {
                log.debug("XMLSecurityException", ex);
            }

            throw new KeyResolverException("generic.EmptyMessage", ex);
        }
    }
View Full Code Here

            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.parse(new ByteArrayInputStream(bytes));
            return doc.getDocumentElement();
        } catch (SAXException ex) {
            throw new KeyResolverException("empty", ex);
        } catch (IOException ex) {
            throw new KeyResolverException("empty", ex);
        } catch (ParserConfigurationException ex) {
            throw new KeyResolverException("empty", ex);
        }
    }
View Full Code Here

            return null;
        } catch (XMLSecurityException ex) {
            if (log.isDebugEnabled()) {
                log.debug("XMLSecurityException", ex);
            }
            throw new KeyResolverException("generic.EmptyMessage", ex);
        }
    }
View Full Code Here

            return null;
        }
        try {        
            if (storage == null) {
                Object exArgs[] = { Constants._TAG_X509SKI };
                KeyResolverException ex =
                    new KeyResolverException("KeyResolver.needStorageResolver", exArgs);

                if (log.isDebugEnabled()) {
                    log.debug("", ex);
                }

                throw ex;
            }

            x509childObject = new XMLX509SKI[x509childNodes.length];

            for (int i = 0; i < x509childNodes.length; i++) {
                x509childObject[i] = new XMLX509SKI(x509childNodes[i], BaseURI);
            }

            Iterator<Certificate> storageIterator = storage.getIterator();
            while (storageIterator.hasNext()) {
                X509Certificate cert = (X509Certificate)storageIterator.next();
                XMLX509SKI certSKI = new XMLX509SKI(element.getOwnerDocument(), cert);

                for (int i = 0; i < x509childObject.length; i++) {
                    if (certSKI.equals(x509childObject[i])) {
                        if (log.isDebugEnabled()) {
                            log.debug("Return PublicKey from " + cert.getSubjectDN().getName());
                        }

                        return cert;
                    }
                }
            }
        } catch (XMLSecurityException ex) {
            throw new KeyResolverException("empty", ex);
        }

        return null;
    }
View Full Code Here

      }
      
      try {
         if (storage == null) {
            Object exArgs[] = { Constants._TAG_X509SUBJECTNAME };
            KeyResolverException ex =
               new KeyResolverException("KeyResolver.needStorageResolver",
                                        exArgs);

            log.info("", ex);

            throw ex;
         }

         x509childObject =
            new XMLX509SubjectName[x509childNodes.length];

         for (int i = 0; i < x509childNodes.length; i++) {
            x509childObject[i] =
               new XMLX509SubjectName(x509childNodes[i],
                                      BaseURI);
         }

         Iterator storageIterator = storage.getIterator();
         while (storageIterator.hasNext()) {
            X509Certificate cert = (X509Certificate)storageIterator.next();
            XMLX509SubjectName certSN =
               new XMLX509SubjectName(element.getOwnerDocument(), cert);

            log.debug("Found Certificate SN: " + certSN.getSubjectName());

            for (int i = 0; i < x509childObject.length; i++) {
               log.debug("Found Element SN:     "
                         + x509childObject[i].getSubjectName());

               if (certSN.equals(x509childObject[i])) {
                  log.debug("match !!! ");

                  return cert;
               }
               log.debug("no match...");              
            }
         }

         return null;
      } catch (XMLSecurityException ex) {
         log.debug("XMLSecurityException", ex);

         throw new KeyResolverException("generic.EmptyMessage", ex);
      }
   }
View Full Code Here

            dbf.setNamespaceAware(true);
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.parse(new ByteArrayInputStream(bytes));
            return doc.getDocumentElement();
        } catch (SAXException ex) {
            throw new KeyResolverException("empty", ex);
        } catch (IOException ex) {
            throw new KeyResolverException("empty", ex);
        } catch (ParserConfigurationException ex) {
            throw new KeyResolverException("empty", ex);
        }
    }
View Full Code Here

         }
         return null;
      } catch (XMLSecurityException ex) {
         log.debug("XMLSecurityException", ex);

         throw new KeyResolverException("generic.EmptyMessage", ex);
      }
   }
View Full Code Here

          return null;
     }
     try {        
         if (storage == null) {
            Object exArgs[] = { Constants._TAG_X509SKI };
            KeyResolverException ex =
               new KeyResolverException("KeyResolver.needStorageResolver",
                                        exArgs);

            log.info("", ex);

            throw ex;
         }

         x509childObject = new XMLX509SKI[x509childNodes.length];

         for (int i = 0; i < x509childNodes.length; i++) {
            x509childObject[i] =
               new XMLX509SKI(x509childNodes[i], BaseURI);
         }

         Iterator storageIterator = storage.getIterator();
         while (storageIterator.hasNext()) {
            X509Certificate cert = (X509Certificate)storageIterator.next();
            XMLX509SKI certSKI = new XMLX509SKI(element.getOwnerDocument(), cert);

            for (int i = 0; i < x509childObject.length; i++) {
               if (certSKI.equals(x509childObject[i])) {
                  log.debug("Return PublicKey from "
                            + cert.getSubjectDN().getName());

                  return cert;
               }
            }
         }
      } catch (XMLSecurityException ex) {
         throw new KeyResolverException("empty", ex);
      }

      return null;
   }
View Full Code Here

TOP

Related Classes of org.apache.xml.security.keys.keyresolver.KeyResolverException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.