javax.xml.crypto.XMLCryptoContext Java Examples
The following examples show how to use
javax.xml.crypto.XMLCryptoContext.
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: ValidationTests.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #2
Source File: KeyValueKeySelector.java From development with Apache License 2.0 | 5 votes |
@Override public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod algorithmMethod, XMLCryptoContext context) throws KeySelectorException { if (keyInfo == null) { throw new KeySelectorException("Null KeyInfo object!"); } @SuppressWarnings("unchecked") List<XMLStructure> list = keyInfo.getContent(); for (XMLStructure xmlStructure : list) { if (xmlStructure instanceof KeyValue) { PublicKey publicKey = null; try { publicKey = ((KeyValue) xmlStructure).getPublicKey(); } catch (KeyException ke) { throw new KeySelectorException(ke); } if (algorithmCompatibleWithMethod( algorithmMethod.getAlgorithm(), publicKey.getAlgorithm())) { return new SimpleKeySelectorResult(publicKey); } } } throw new KeySelectorException("No RSA/DSA KeyValue element found"); }
Example #3
Source File: GenerationTests.java From hottub with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #4
Source File: GenerationTests.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #5
Source File: GenerationTests.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #6
Source File: ValidationTests.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #7
Source File: X509KeySelector.java From SAMLRaider with MIT License | 5 votes |
public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod method, XMLCryptoContext context) throws KeySelectorException { @SuppressWarnings("rawtypes") Iterator ki = keyInfo.getContent().iterator(); while (ki.hasNext()) { XMLStructure info = (XMLStructure) ki.next(); if (!(info instanceof X509Data)) continue; X509Data x509Data = (X509Data) info; @SuppressWarnings("rawtypes") Iterator xi = x509Data.getContent().iterator(); while (xi.hasNext()) { Object o = xi.next(); if (!(o instanceof X509Certificate)) continue; final PublicKey key = ((X509Certificate)o).getPublicKey(); // Make sure the algorithm is compatible // with the method. if (algEquals(method.getAlgorithm(), key.getAlgorithm())) { return new KeySelectorResult() { public Key getKey() { return key; } }; } } } throw new KeySelectorException("No key found!"); }
Example #8
Source File: GenerationTests.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #9
Source File: ValidationTests.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #10
Source File: ValidationTests.java From hottub with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #11
Source File: X509KeySelector.java From development with Apache License 2.0 | 5 votes |
@Override public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod algorithmMethod, XMLCryptoContext context) throws KeySelectorException { if (keyInfo == null) { throw new KeySelectorException("Null KeyInfo object!"); } @SuppressWarnings("unchecked") List<XMLStructure> list = keyInfo.getContent(); for (XMLStructure xmlStructure : list) { if (xmlStructure instanceof X509Data) { X509Data x509Data = (X509Data) xmlStructure; @SuppressWarnings("rawtypes") List content = x509Data.getContent(); for (int i = 0; i < content.size(); i++) { Object x509Content = content.get(i); if (x509Content instanceof X509Certificate) { X509Certificate certificate = (X509Certificate) x509Content; try { return getPublicKeyFromKeystore(certificate, (SignatureMethod) algorithmMethod); } catch (KeyStoreException e) { throw new KeySelectorException(e); } } } } } throw new KeySelectorException("No X509Data element found."); }
Example #12
Source File: XMLSignatureUtil.java From keycloak with Apache License 2.0 | 5 votes |
@Override public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod method, XMLCryptoContext context) { return new KeySelectorResult() { @Override public Key getKey() { return key; } }; }
Example #13
Source File: GenerationTests.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #14
Source File: X509KeySelector.java From io with Apache License 2.0 | 5 votes |
@SuppressWarnings("rawtypes") @Override public final KeySelectorResult select( final KeyInfo keyInfoToUse, final KeySelector.Purpose purpose, final AlgorithmMethod method, final XMLCryptoContext context) throws KeySelectorException { Iterator ki = keyInfoToUse.getContent().iterator(); while (ki.hasNext()) { XMLStructure info = (XMLStructure) ki.next(); if (!(info instanceof X509Data)) { continue; } X509Data x509Data = (X509Data) info; Iterator xi = x509Data.getContent().iterator(); while (xi.hasNext()) { Object o = xi.next(); if (!(o instanceof X509Certificate)) { continue; } X509Certificate x509Certificate = (X509Certificate) o; final PublicKey key = x509Certificate.getPublicKey(); // Make sure the algorithm is compatible // with the method. if (algEquals(method.getAlgorithm(), key.getAlgorithm())) { // x509証明書検証 cheakX509validate(x509Certificate); return new KeySelectorResult() { @Override public Key getKey() { return key; } }; } } } throw new KeySelectorException("No key found!"); }
Example #15
Source File: KeyValueKeySelector.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public KeySelectorResult select ( final KeyInfo keyInfo, final KeySelector.Purpose purpose, final AlgorithmMethod method, final XMLCryptoContext context ) throws KeySelectorException { if ( keyInfo == null ) { throw new KeySelectorException ( "Null KeyInfo object!" ); } final SignatureMethod sm = (SignatureMethod)method; final List<?> list = keyInfo.getContent (); for ( int i = 0; i < list.size (); i++ ) { final XMLStructure xmlStructure = (XMLStructure)list.get ( i ); if ( xmlStructure instanceof KeyValue ) { try { final PublicKey pk = ( (KeyValue)xmlStructure ).getPublicKey (); // make sure algorithm is compatible with method if ( algEquals ( sm.getAlgorithm (), pk.getAlgorithm () ) ) { return new SimpleKeySelectorResult ( pk ); } } catch ( final KeyException ke ) { throw new KeySelectorException ( ke ); } } } throw new KeySelectorException ( "No KeyValue element found!" ); }
Example #16
Source File: GenerationTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #17
Source File: GenerationTests.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public Data dereference(final URIReference ref, XMLCryptoContext ctx) throws URIReferenceException { String uri = ref.getURI(); if (uri.equals(STYLESHEET) || uri.equals(STYLESHEET_B64)) { try { FileInputStream fis = new FileInputStream(new File (DATA_DIR, uri.substring(uri.lastIndexOf('/')))); return new OctetStreamData(fis,ref.getURI(),ref.getType()); } catch (Exception e) { throw new URIReferenceException(e); } } // fallback on builtin deref return defaultUd.dereference(ref, ctx); }
Example #18
Source File: Utils.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private static boolean getBoolean(XMLCryptoContext xc, String name) { Boolean value = (Boolean)xc.getProperty(name); return (value != null && value.booleanValue()); }
Example #19
Source File: Utils.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static boolean getBoolean(XMLCryptoContext xc, String name) { Boolean value = (Boolean)xc.getProperty(name); return (value != null && value.booleanValue()); }
Example #20
Source File: Utils.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private static boolean getBoolean(XMLCryptoContext xc, String name) { Boolean value = (Boolean)xc.getProperty(name); return (value != null && value.booleanValue()); }
Example #21
Source File: Utils.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
static boolean secureValidation(XMLCryptoContext xc) { if (xc == null) { return false; } return getBoolean(xc, "org.jcp.xml.dsig.secureValidation"); }
Example #22
Source File: Utils.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private static boolean getBoolean(XMLCryptoContext xc, String name) { Boolean value = (Boolean)xc.getProperty(name); return (value != null && value.booleanValue()); }
Example #23
Source File: Utils.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
static boolean secureValidation(XMLCryptoContext xc) { if (xc == null) { return false; } return getBoolean(xc, "org.jcp.xml.dsig.secureValidation"); }
Example #24
Source File: Utils.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
static boolean secureValidation(XMLCryptoContext xc) { if (xc == null) { return false; } return getBoolean(xc, "org.jcp.xml.dsig.secureValidation"); }
Example #25
Source File: Utils.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static boolean getBoolean(XMLCryptoContext xc, String name) { Boolean value = (Boolean)xc.getProperty(name); return (value != null && value.booleanValue()); }
Example #26
Source File: Utils.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static boolean getBoolean(XMLCryptoContext xc, String name) { Boolean value = (Boolean)xc.getProperty(name); return (value != null && value.booleanValue()); }
Example #27
Source File: Utils.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private static boolean getBoolean(XMLCryptoContext xc, String name) { Boolean value = (Boolean)xc.getProperty(name); return (value != null && value.booleanValue()); }
Example #28
Source File: Utils.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
static boolean secureValidation(XMLCryptoContext xc) { if (xc == null) { return false; } return getBoolean(xc, "org.jcp.xml.dsig.secureValidation"); }
Example #29
Source File: Utils.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static boolean getBoolean(XMLCryptoContext xc, String name) { Boolean value = (Boolean)xc.getProperty(name); return (value != null && value.booleanValue()); }
Example #30
Source File: Utils.java From hottub with GNU General Public License v2.0 | 4 votes |
private static boolean getBoolean(XMLCryptoContext xc, String name) { Boolean value = (Boolean)xc.getProperty(name); return (value != null && value.booleanValue()); }