public boolean match(Object obj) { if (!(obj instanceof X509Certificate)) { return false; } X509Certificate other = (X509Certificate)obj; return super.match(other); }
public boolean match(Object obj) { if (!(obj instanceof X509Certificate)) { return false; } X509Certificate other = (X509Certificate)obj; return super.match(other); }
public boolean match(Object obj) { if (!(obj instanceof X509Certificate)) { return false; } X509Certificate other = (X509Certificate)obj; return super.match(other); }
public boolean match(Object obj) { if (!(obj instanceof X509Certificate)) { return false; } X509Certificate other = (X509Certificate)obj; return super.match(other); }
public boolean match(Object obj) { if (!(obj instanceof X509Certificate)) { return false; } X509Certificate other = (X509Certificate)obj; return super.match(other); }
public boolean match(Object obj) { if (!(obj instanceof X509Certificate)) { return false; } X509Certificate other = (X509Certificate)obj; return super.match(other); }
/** {@inheritDoc} */ public Boolean evaluate(Credential target) { if (target == null) { log.error("Credential target was null"); return null; } if (!(target instanceof X509Credential)) { log.info("Credential is not an X509Credential, can not evaluate X509CertSelector criteria"); return Boolean.FALSE; } X509Credential x509Cred = (X509Credential) target; X509Certificate entityCert = x509Cred.getEntityCertificate(); if (entityCert == null) { log.info("X509Credential did not contain an entity certificate, can not evaluate X509CertSelector criteria"); return Boolean.FALSE; } Boolean result = certSelector.match(entityCert); return result; }
/** {@inheritDoc} */ public Boolean evaluate(Credential target) { if (target == null) { log.error("Credential target was null"); return null; } if (!(target instanceof X509Credential)) { log.info("Credential is not an X509Credential, can not evaluate X509CertSelector criteria"); return Boolean.FALSE; } X509Credential x509Cred = (X509Credential) target; X509Certificate entityCert = x509Cred.getEntityCertificate(); if (entityCert == null) { log.info("X509Credential did not contain an entity certificate, can not evaluate X509CertSelector criteria"); return Boolean.FALSE; } Boolean result = certSelector.match(entityCert); return result; }
if (xselector.match(cert))
if (xselector.match(cert))
if (xselector.match(cert))
if (xselector.match(cert))
private void init(String fileName, String password, X509Cert.KeyUsage keyUsage, String alias) { logger.info("Using PKCS#12 signature token from file: " + fileName); try { signatureTokenConnection = new Pkcs12SignatureToken(fileName, password); } catch (IOException e) { throw new DigiDoc4JException(e.getMessage()); } if (alias != null) { logger.debug("Searching key with alias: " + alias); keyEntry = signatureTokenConnection.getKey(alias, password); } else { logger.debug("Searching key by usage: " + keyUsage.name()); List<DSSPrivateKeyEntry> keys = signatureTokenConnection.getKeys(); X509CertSelector selector = new X509CertSelector(); selector.setKeyUsage(getUsageBitArray(keyUsage)); // TODO: Test this! for (DSSPrivateKeyEntry key : keys) { if (selector.match(key.getCertificate().getCertificate())) { keyEntry = (KSPrivateKeyEntry) key; break; } } } if (keyEntry == null && signatureTokenConnection.getKeys().size() > 0) keyEntry = (KSPrivateKeyEntry)signatureTokenConnection.getKeys().get(0); }
private KSPrivateKeyEntry findPrivateKey(X509Cert.KeyUsage keyUsage) { logger.debug("Searching key by usage: " + keyUsage.name()); List<DSSPrivateKeyEntry> keys = getPrivateKeyEntries(); X509CertSelector selector = new X509CertSelector(); selector.setKeyUsage(getUsageBitArray(keyUsage)); // TODO: Test this! for (DSSPrivateKeyEntry key : keys) { if (selector.match(key.getCertificate().getCertificate())) { if (label == null || ((KSPrivateKeyEntry) key).getAlias().contains(label)) { logger.debug("... Found key by keyUsage. Key encryption algorithm:" + key.getEncryptionAlgorithm().getName()); return (KSPrivateKeyEntry) key; } } } throw new TechnicalException("Error getting private key entry!"); }
if (trust.getTrustedCert() != null) if (certSelectX509.match(trust.getTrustedCert()))
if (trust.getTrustedCert() != null) if (certSelectX509.match(trust.getTrustedCert()))
if (trust.getTrustedCert() != null) if (certSelectX509.match(trust.getTrustedCert()))
if (trust.getTrustedCert() != null) if (certSelectX509.match(trust.getTrustedCert()))
if (trust.getTrustedCert() != null) if (certSelectX509.match(trust.getTrustedCert()))
if (trust.getTrustedCert() != null) if (certSelectX509.match(trust.getTrustedCert()))