public ConcurrentContentSigner getSigner(List<String> algoNames) { if (CollectionUtil.isEmpty(algoNames)) { return dfltSigner; } for (String name : algoNames) { if (signers.containsKey(name)) { return signers.get(name); } } return null; }
public boolean isCertprofilePermitted(String certprofile) { if (CollectionUtil.isEmpty(profiles)) { return false; } return profiles.contains("all") || profiles.contains(certprofile.toLowerCase()); }
public boolean isCertprofilePermitted(String certprofile) { if (CollectionUtil.isEmpty(profiles)) { return false; } return profiles.contains("all") || profiles.contains(certprofile.toLowerCase()); }
private static String formatUris(List<String> uris) { if (CollectionUtil.isEmpty(uris)) { return ""; } StringBuilder sb = new StringBuilder(); for (String uri : uris) { sb.append("\n ").append(uri); } return sb.toString(); }
public void setCertificates(X509Certificate[] certificateChain) throws P11TokenException { if (CollectionUtil.isEmpty(certificateChain)) { this.certificateChain = null; } else { PublicKey pk = certificateChain[0].getPublicKey(); if (!this.publicKey.equals(pk)) { throw new P11TokenException("certificateChain is not for the key"); } this.certificateChain = certificateChain; } }
public void setCertificates(X509Certificate[] certificateChain) throws P11TokenException { if (CollectionUtil.isEmpty(certificateChain)) { this.certificateChain = null; } else { PublicKey pk = certificateChain[0].getPublicKey(); if (!this.publicKey.equals(pk)) { throw new P11TokenException("certificateChain is not for the key"); } this.certificateChain = certificateChain; } }
@Override public boolean isCertprofilePermitted(String certprofile) { Set<String> profiles = caHasUser.getProfiles(); if (CollectionUtil.isEmpty(profiles)) { return false; } return profiles.contains("all") || profiles.contains(certprofile.toLowerCase()); }
public static Set<ASN1ObjectIdentifier> toOidSet(List<OidWithDescType> oidWithDescTypes) { if (CollectionUtil.isEmpty(oidWithDescTypes)) { return null; } Set<ASN1ObjectIdentifier> oids = new HashSet<>(); for (OidWithDescType type : oidWithDescTypes) { oids.add(new ASN1ObjectIdentifier(type.getValue())); } return Collections.unmodifiableSet(oids); }
public static List<ASN1ObjectIdentifier> toOidList( List<OidWithDescType> oidWithDescTypes) { if (CollectionUtil.isEmpty(oidWithDescTypes)) { return null; } List<ASN1ObjectIdentifier> oids = new LinkedList<>(); for (OidWithDescType type : oidWithDescTypes) { oids.add(new ASN1ObjectIdentifier(type.getValue())); } return Collections.unmodifiableList(oids); } // method toOidList
private void forceLogin(Session session) throws P11TokenException { if (CollectionUtil.isEmpty(password)) { LOG.info("verify on PKCS11Module with NULL PIN"); singleLogin(session, null); } else { LOG.info("verify on PKCS11Module with PIN"); for (char[] singlePwd : password) { singleLogin(session, singlePwd); } } }
public static GeneralNames createGeneralNames(List<String> taggedValues) throws BadInputException { if (CollectionUtil.isEmpty(taggedValues)) { return null; } int len = taggedValues.size(); GeneralName[] names = new GeneralName[len]; for (int i = 0; i < len; i++) { names[i] = createGeneralName(taggedValues.get(i)); } return new GeneralNames(names); }
public void setProfiles(Set<String> profiles) { if (CollectionUtil.isEmpty(profiles)) { this.profiles = Collections.emptySet(); } else { this.profiles = CollectionUtil.unmodifiableSet(CollectionUtil.toLowerCaseSet(profiles)); } }
public void setProfiles(Set<String> profiles) { if (CollectionUtil.isEmpty(profiles)) { this.profiles = Collections.emptySet(); } else { this.profiles = CollectionUtil.unmodifiableSet(CollectionUtil.toLowerCaseSet(profiles)); } }
public GeneralNameMode(GeneralNameTag tag, Set<ASN1ObjectIdentifier> allowedTypes) { this.tag = Args.notNull(tag, "tag"); this.allowedTypes = CollectionUtil.isEmpty(allowedTypes) ? Collections.emptySet() : CollectionUtil.unmodifiableSet(allowedTypes); }
public static org.bouncycastle.asn1.x509.KeyUsage createKeyUsage(Set<KeyUsage> usages) { if (CollectionUtil.isEmpty(usages)) { return null; } int usage = 0; for (KeyUsage keyUsage : usages) { usage |= keyUsage.getBcUsage(); } return new org.bouncycastle.asn1.x509.KeyUsage(usage); }
private static RDN[] getRdns(RDN[] rdns, ASN1ObjectIdentifier type) { Args.notNull(rdns, "rdns"); Args.notNull(type, "type"); List<RDN> ret = new ArrayList<>(1); for (int i = 0; i < rdns.length; i++) { RDN rdn = rdns[i]; if (rdn.getFirst().getType().equals(type)) { ret.add(rdn); } } return CollectionUtil.isEmpty(ret) ? null : ret.toArray(new RDN[0]); }
private static RDN[] getRdns(RDN[] rdns, ASN1ObjectIdentifier type) { Args.notNull(rdns, "rdns"); Args.notNull(type, "type"); List<RDN> ret = new ArrayList<>(1); for (int i = 0; i < rdns.length; i++) { RDN rdn = rdns[i]; if (rdn.getFirst().getType().equals(type)) { ret.add(rdn); } } return CollectionUtil.isEmpty(ret) ? null : ret.toArray(new RDN[0]); }
public boolean isMechanismPermitted(P11SlotIdentifier slotId, long mechanism) { Args.notNull(slotId, "slotId"); if (CollectionUtil.isEmpty(singleFilters)) { return true; } for (P11SingleMechanismFilter sr : singleFilters) { if (sr.match(slotId)) { return sr.isMechanismSupported(mechanism); } } return true; }
public List<char[]> getPassword(P11SlotIdentifier slotId) throws PasswordResolverException { Args.notNull(slotId, "slotId"); if (CollectionUtil.isEmpty(singleRetrievers)) { return null; } for (P11SinglePasswordRetriever sr : singleRetrievers) { if (sr.match(slotId)) { return sr.getPasswords(passwordResolver); } } return null; }
public List<char[]> getPassword(P11SlotIdentifier slotId) throws PasswordResolverException { ParamUtil.requireNonNull("slotId", slotId); if (CollectionUtil.isEmpty(singleRetrievers)) { return null; } for (SingleRetriever sr : singleRetrievers) { if (sr.match(slotId)) { return sr.getPasswords(passwordResolver); } } return null; }