public Merlin(Properties properties, ClassLoader loader) throws CredentialException, IOException { loadProperties(properties, loader); }
/** * Validate a public key * @throws WSSecurityException */ protected boolean validatePublicKey(PublicKey publicKey, Crypto crypto) throws WSSecurityException { return crypto.verifyTrust(publicKey); }
/** * Confirm that the byte at the current position matches the given value. * * @param val the expected next byte. * @throws WSSecurityException * if the current position is at the end of the array, or if the * byte at the current position doesn't match the expected value. */ public void expect(int val) throws WSSecurityException { expect((byte)(val & 0xFF)); }
public X509Certificate getX509SKIAlias(Crypto crypto) throws WSSecurityException { if (skiBytes == null) { skiBytes = getSKIBytes(); if (skiBytes == null) { return null; } } CryptoType cryptoType = new CryptoType(CryptoType.TYPE.SKI_BYTES); cryptoType.setBytes(skiBytes); X509Certificate[] certs = crypto.getX509Certificates(cryptoType); if (certs != null) { return certs[0]; } return null; }
public static Crypto getInstance( String propFilename, ClassLoader customClassLoader ) throws WSSecurityException { Properties properties = getProperties(propFilename, customClassLoader); return getInstance(properties, customClassLoader); }
public String nextToken() { if (hasMoreTokens()) { return (String) tokens.get(index++); } else { return ""; } }
/** * getInstance * <p/> * Returns an instance of Crypto. This method uses the file * <code>crypto.properties</code> to determine which implementation to * use. Thus the property <code>org.apache.ws.security.crypto.provider</code> * must define the classname of the Crypto implementation. The file * may contain other property definitions as well. These properties are * handed over to the Crypto implementation. The file * <code>crypto.properties</code> is loaded with the * <code>Loader.getResource()</code> method. * <p/> * * @return The crypto implementation was defined * @throws WSSecurityException if there is an error in loading the crypto properties */ public static Crypto getInstance() throws WSSecurityException { return getInstance("crypto.properties"); }
/** * Constructor. * <p/> * * @param errorCode * @param msgId * @param args * @param root */ public CredentialException(int errorCode, String msgId, Object[] args, Throwable root) { super(getMessage(msgId, args), root); this.errorCode = errorCode; }
/** * Evaluate whether a given certificate chain should be trusted. * * @param certs Certificate chain to validate * @return true if the certificate chain is valid, false otherwise * @throws WSSecurityException */ @Deprecated public boolean verifyTrust(X509Certificate[] certs) throws WSSecurityException { return verifyTrust(certs, false); }
/** * Get the implementation-specific identifier corresponding to the cert parameter. In this * case, the identifier corresponds to a KeyStore alias. * @param cert The X509Certificate for which to search for an identifier * @return the identifier corresponding to the cert parameter * @throws WSSecurityException */ public String getX509Identifier(X509Certificate cert) throws WSSecurityException { String identifier = null; if (keystore != null) { identifier = getIdentifier(cert, keystore); } if (identifier == null && truststore != null) { identifier = getIdentifier(cert, truststore); } return identifier; }
/** * Evaluate whether a given certificate chain should be trusted. * Uses the CertPath API to validate a given certificate chain. * * @param certs Certificate chain to validate * @return true if the certificate chain is valid, false otherwise * @throws WSSecurityException */ @Deprecated public boolean verifyTrust(X509Certificate[] certs) throws WSSecurityException { return verifyTrust(certs, false); }
/** * Check the asymmetric key length */ public void checkAsymmetricKeyLength( X509Certificate x509Certificate ) throws WSSecurityException { if (x509Certificate == null) { return; } checkAsymmetricKeyLength(x509Certificate.getPublicKey()); }
public X509Certificate getX509SKIAlias(Crypto crypto) throws WSSecurityException { if (skiBytes == null) { skiBytes = getSKIBytes(); if (skiBytes == null) { return null; } } CryptoType cryptoType = new CryptoType(CryptoType.TYPE.SKI_BYTES); cryptoType.setBytes(skiBytes); X509Certificate[] certs = crypto.getX509Certificates(cryptoType); if (certs != null) { return certs[0]; } return null; }
public static Crypto getInstance( String propFilename, ClassLoader customClassLoader ) throws WSSecurityException { Properties properties = getProperties(propFilename, customClassLoader); return getInstance(properties, customClassLoader); }
/** * Validate a public key * @throws WSSecurityException */ protected boolean validatePublicKey(PublicKey publicKey, Crypto crypto) throws WSSecurityException { return crypto.verifyTrust(publicKey); }
public Merlin(Properties properties, ClassLoader loader) throws CredentialException, IOException { loadProperties(properties, loader); }
/** * Confirm that the byte at the current position matches the given value. * * @param val the expected next byte. * @throws WSSecurityException * if the current position is at the end of the array, or if the * byte at the current position doesn't match the expected value. */ public void expect(int val) throws WSSecurityException { expect((byte)(val & 0xFF)); }
/** * Constructor. * <p/> * * @param errorCode * @param msgId * @param args * @param root */ public CredentialException(int errorCode, String msgId, Object[] args, Throwable root) { super(getMessage(msgId, args), root); this.errorCode = errorCode; }
/** * Evaluate whether a given certificate chain should be trusted. * * @param certs Certificate chain to validate * @return true if the certificate chain is valid, false otherwise * @throws WSSecurityException */ @Deprecated public boolean verifyTrust(X509Certificate[] certs) throws WSSecurityException { return verifyTrust(certs, false); }
public void loadProperties(Properties properties) throws CredentialException, IOException { loadProperties(properties, Loader.getClassLoader(Merlin.class)); }