com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolver Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolver. 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: KeyInfo.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #2
Source File: KeyInfo.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #3
Source File: KeyInfo.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #4
Source File: KeyInfo.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #5
Source File: KeyInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #6
Source File: KeyInfo.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #7
Source File: KeyInfo.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #8
Source File: KeyInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #9
Source File: KeyInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #10
Source File: KeyInfo.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #11
Source File: KeyInfo.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #12
Source File: KeyInfo.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #13
Source File: KeyInfo.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #14
Source File: KeyInfo.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #15
Source File: KeyInfo.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #16
Source File: KeyInfo.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #17
Source File: KeyInfo.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #18
Source File: KeyInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #19
Source File: KeyInfo.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #20
Source File: KeyInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for public keys
 *
 * @return The public key contained in this Node.
 * @throws KeyResolverException
 */
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null) {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    PublicKey pk =
                        keyResolver.engineLookupAndResolvePublicKey(
                            (Element) currentChild, uri, storage
                        );

                    if (pk != null) {
                        return pk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #21
Source File: KeyInfo.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #22
Source File: KeyInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #23
Source File: KeyInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method uses each System-wide {@link KeyResolver} to search the
 * child elements. Each combination of {@link KeyResolver} and child element
 * is checked against all {@link StorageResolver}s.
 *
 * @return The certificate contained in this KeyInfo
 * @throws KeyResolverException
 */
X509Certificate getX509CertificateFromStaticResolvers()
    throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE,
            "Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
            + " resolvers"
        );
    }
    String uri = this.getBaseURI();
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);
        X509Certificate cert = applyCurrentResolver(uri, keyResolver);
        if (cert != null) {
            return cert;
        }
    }
    return null;
}
 
Example #24
Source File: RetrievalMethodResolver.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Retrieves a x509Certificate from the given information
 * @param e
 * @param baseURI
 * @param storage
 * @return
 * @throws KeyResolverException
 */
private static X509Certificate resolveCertificate(
    Element e, String baseURI, StorageResolver storage
) throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Now we have a {" + e.getNamespaceURI() + "}"
            + e.getLocalName() + " Element");
    }
    // An element has been provided
    if (e != null) {
        return KeyResolver.getX509Certificate(e, baseURI, storage);
    }
    return null;
}
 
Example #25
Source File: KeyInfo.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for Secret keys
 *
 * @return the secret key contained in this KeyInfo
 * @throws KeyResolverException
 */
SecretKey getSecretKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);

        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null)      {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    SecretKey sk =
                        keyResolver.engineLookupAndResolveSecretKey(
                            (Element) currentChild, uri, storage
                        );

                    if (sk != null) {
                        return sk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #26
Source File: RetrievalMethodResolver.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Retrieves a x509Certificate from the given information
 * @param e
 * @param baseURI
 * @param storage
 * @return
 * @throws KeyResolverException
 */
private static X509Certificate resolveCertificate(
    Element e, String baseURI, StorageResolver storage
) throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Now we have a {" + e.getNamespaceURI() + "}"
            + e.getLocalName() + " Element");
    }
    // An element has been provided
    if (e != null) {
        return KeyResolver.getX509Certificate(e, baseURI, storage);
    }
    return null;
}
 
Example #27
Source File: KeyInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for Private keys
 *
 * @return the private key contained in this KeyInfo
 * @throws KeyResolverException
 */
PrivateKey getPrivateKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);

        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null)      {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                // not using StorageResolvers at the moment
                // since they cannot return private keys
                PrivateKey pk =
                    keyResolver.engineLookupAndResolvePrivateKey(
                        (Element) currentChild, uri, null
                    );

                if (pk != null) {
                    return pk;
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #28
Source File: KeyInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the library wide KeyResolvers for Secret keys
 *
 * @return the secret key contained in this KeyInfo
 * @throws KeyResolverException
 */
SecretKey getSecretKeyFromStaticResolvers() throws KeyResolverException {
    Iterator<KeyResolverSpi> it = KeyResolver.iterator();
    while (it.hasNext()) {
        KeyResolverSpi keyResolver = it.next();
        keyResolver.setSecureValidation(secureValidation);

        Node currentChild = this.constructionElement.getFirstChild();
        String uri = this.getBaseURI();
        while (currentChild != null)      {
            if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
                for (StorageResolver storage : storageResolvers) {
                    SecretKey sk =
                        keyResolver.engineLookupAndResolveSecretKey(
                            (Element) currentChild, uri, storage
                        );

                    if (sk != null) {
                        return sk;
                    }
                }
            }
            currentChild = currentChild.getNextSibling();
        }
    }
    return null;
}
 
Example #29
Source File: RetrievalMethodResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Retrieves a PublicKey from the given information
 * @param e
 * @param baseURI
 * @param storage
 * @return
 * @throws KeyResolverException
 */
private static PublicKey resolveKey(
    Element e, String baseURI, StorageResolver storage
) throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Now we have a {" + e.getNamespaceURI() + "}"
            + e.getLocalName() + " Element");
    }
    // An element has been provided
    if (e != null) {
        return KeyResolver.getPublicKey(e, baseURI, storage);
    }
    return null;
}
 
Example #30
Source File: RetrievalMethodResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Retrieves a x509Certificate from the given information
 * @param e
 * @param baseURI
 * @param storage
 * @return
 * @throws KeyResolverException
 */
private static X509Certificate resolveCertificate(
    Element e, String baseURI, StorageResolver storage
) throws KeyResolverException {
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Now we have a {" + e.getNamespaceURI() + "}"
            + e.getLocalName() + " Element");
    }
    // An element has been provided
    if (e != null) {
        return KeyResolver.getX509Certificate(e, baseURI, storage);
    }
    return null;
}