本文整理了Java中org.xipki.util.Args.notBlank()
方法的一些代码示例,展示了Args.notBlank()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.notBlank()
方法的具体详情如下:
包路径:org.xipki.util.Args
类名称:Args
方法名:notBlank
暂无
代码示例来源:origin: org.xipki/ca-server
SystemEvent(String name, String owner, long eventTime) {
this.name = Args.notBlank(name, "name");
this.owner = Args.notBlank(owner, "owner");
this.eventTime = eventTime;
}
代码示例来源:origin: org.xipki/datasource
protected String getSqlToDropPrimaryKey(String primaryKeyName, String table) {
Args.notBlank(primaryKeyName, "primaryKeyName");
Args.notBlank(table, "table");
return StringUtil.concat("ALTER TABLE ", table, " DROP PRIMARY KEY ");
}
代码示例来源:origin: org.xipki/security
public static KeyStore getKeyStore(String storeType) throws KeyStoreException {
Args.notBlank(storeType, "storeType");
if ("JKS".equalsIgnoreCase(storeType) || "JCEKS".equalsIgnoreCase(storeType)) {
return KeyStore.getInstance(storeType);
} else {
try {
return KeyStore.getInstance(storeType, "BC");
} catch (KeyStoreException | NoSuchProviderException ex) {
return KeyStore.getInstance(storeType);
}
}
}
代码示例来源:origin: org.xipki/ca-server
public void setConfFile(String confFile) {
Args.notBlank(confFile, "confFile");
Properties confProps = new Properties();
try {
confProps.load(Files.newInputStream(Paths.get(IoUtil.expandFilepath(confFile))));
} catch (IOException ex) {
throw new IllegalArgumentException("could not parse CA configuration file " + confFile, ex);
}
this.confProperties = confProps;
}
代码示例来源:origin: org.xipki/ca-server
final void addEntry(String name, Integer id) {
Args.notBlank(name, "name");
Args.notNull(id, "id");
if (entries.containsKey(name)) {
throw new IllegalArgumentException("entry with the same name " + name + " already available");
}
if (entries.containsValue(id)) {
throw new IllegalArgumentException("entry with the same id " + id + " already available");
}
entries.put(name, id);
}
代码示例来源:origin: org.xipki/ca-api
public GenSelfIssued(String profile, byte[] csr, BigInteger serialNumber,
String certOutputFormat) {
this.profile = Args.notBlank(profile, "profile");
this.csr = Args.notNull(csr, "csr");
this.serialNumber = serialNumber;
this.certOutputFormat = certOutputFormat;
}
代码示例来源:origin: org.xipki/ca-mgmt-client
public void setServerUrl(String serverUrl) throws MalformedURLException {
Args.notBlank(serverUrl, "serverUrl");
this.serverUrl = serverUrl.endsWith("/") ? serverUrl : serverUrl + "/";
for (MgmtAction action : MgmtAction.values()) {
actionUrlMap.put(action, new URL(this.serverUrl + action));
}
}
代码示例来源:origin: org.xipki/ca-server
/**
* Validates a password using a hash.
*
* @param password - the password to check
* @param correctHash - the hash of the valid password
* @return true if the password is correct, false if not
*/
public static boolean validatePassword(String password, String correctHash) {
Args.notBlank(password, "password");
return validatePassword(password.getBytes(), correctHash);
}
代码示例来源:origin: org.xipki/ca-server
CertBasedIdentityEntry(int id, String subject, String b64Sha1Fp, String b64Cert) {
this.id = id;
this.subject = subject;
this.sha1Fp = Base64.decode(Args.notBlank(b64Sha1Fp, "b64Sha1Fp"));
this.cert = Base64.decode(Args.notBlank(b64Cert, "b64Cert"));
}
代码示例来源:origin: org.xipki/ca-mgmt-client
protected void commit(String task) throws DataAccessException {
Args.notBlank(task, "task");
try {
connection.commit();
} catch (SQLException ex) {
throw datasource.translate(task, ex);
}
}
代码示例来源:origin: org.xipki/security
public static ASN1ObjectIdentifier getHashAlg(String hashAlgName)
throws NoSuchAlgorithmException {
Args.notBlank(hashAlgName, "hashAlgName");
HashAlgo hashAlgo = HashAlgo.getInstance(hashAlgName.toUpperCase());
if (hashAlgo == null) {
throw new NoSuchAlgorithmException("Unsupported hash algorithm " + hashAlgName);
}
return hashAlgo.getOid();
} // method getHashAlg
代码示例来源:origin: org.xipki/ca-api
static String signerConfToString(String signerConf, boolean verbose,
boolean ignoreSensitiveInfo) {
Args.notBlank(signerConf, "signerConf");
if (ignoreSensitiveInfo) {
signerConf = SignerConf.eraseSensitiveData(signerConf);
}
if (verbose || signerConf.length() < 101) {
return signerConf;
} else {
return StringUtil.concat(signerConf.substring(0, 97), "...");
}
}
代码示例来源:origin: org.xipki/security
public SignerConf(String conf) {
this.hashAlgo = null;
this.signatureAlgoControl = null;
this.confPairs = new ConfPairs(Args.notBlank(conf, "conf"));
if (getConfValue("algo") == null) {
throw new IllegalArgumentException("conf must contain the entry 'algo'");
}
}
代码示例来源:origin: org.xipki/security
public static ASN1ObjectIdentifier getCurveOidForCurveNameOrOid(String curveNameOrOid) {
Args.notBlank(curveNameOrOid, "curveNameOrOid");
ASN1ObjectIdentifier oid;
try {
oid = new ASN1ObjectIdentifier(curveNameOrOid);
} catch (Exception ex) {
oid = getCurveOidForName(curveNameOrOid);
}
return oid;
}
代码示例来源:origin: org.xipki/security
protected P11Slot(String moduleName, P11SlotIdentifier slotId, boolean readOnly,
P11MechanismFilter mechanismFilter) throws P11TokenException {
this.mechanismFilter = Args.notNull(mechanismFilter, "mechanismFilter");
this.moduleName = Args.notBlank(moduleName, "moduleName");
this.slotId = Args.notNull(slotId, "slotId");
this.readOnly = readOnly;
}
代码示例来源:origin: org.xipki/security
public SignerConf(String confWithoutAlgo, HashAlgo hashAlgo,
SignatureAlgoControl signatureAlgoControl) {
this.hashAlgo = Args.notNull(hashAlgo, "hashAlgo");
this.signatureAlgoControl = signatureAlgoControl;
this.confPairs = new ConfPairs(Args.notBlank(confWithoutAlgo, "confWithoutAlgo"));
if (getConfValue("algo") != null) {
throw new IllegalArgumentException("confWithoutAlgo may not contain the entry 'algo'");
}
}
代码示例来源:origin: org.xipki/security
@Override
public ConcurrentContentSigner newSigner(SecurityFactory securityFactory, String type,
SignerConf conf, X509Certificate[] certificateChain) throws ObjectCreationException {
Args.notBlank(type, "type");
for (SignerFactory service : factories) {
if (service.canCreateSigner(type)) {
return service.newSigner(type, conf, certificateChain);
}
}
throw new ObjectCreationException("could not find Factory to create Signer of type " + type);
}
代码示例来源:origin: org.xipki/cmpclient
CaConf(String name, String url, String healthUrl, String requestorName,
Responder responder,
SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier) {
this.name = Args.toNonBlankLower(name, "name");
this.url = Args.notBlank(url, "url");
this.requestorName = Args.notNull(requestorName, "requestorName");
this.responder = Args.notNull(responder, "responder");
this.healthUrl = StringUtil.isBlank(healthUrl) ? url.replace("cmp", "health") : healthUrl;
this.sslSocketFactory = sslSocketFactory;
this.hostnameVerifier = hostnameVerifier;
}
代码示例来源:origin: xipki/xipki
@Override
public void init(String conf) throws PasswordResolverException {
Args.notBlank(conf, "conf");
ConfPairs pairs = new ConfPairs(conf);
passwordFile = pairs.value("file");
if (StringUtil.isBlank(passwordFile)) {
throw new PasswordResolverException("invalid configuration " + conf
+ ", no file is specified");
}
passwordFile = IoUtil.expandFilepath(passwordFile);
}
代码示例来源:origin: org.xipki/ca-api
public Ca(NameId ident, int serialNoBitLen, long nextCrlNumber, String signerType,
String signerConf, CaUris caUris, int numCrls, int expirationPeriod) {
this.ident = Args.notNull(ident, "ident");
this.signerType = Args.toNonBlankLower(signerType, "signerType");
this.expirationPeriod = Args.notNegative(expirationPeriod, "expirationPeriod");
this.signerConf = Args.notBlank(signerConf, "signerConf");
this.numCrls = Args.positive(numCrls, "numCrls");
this.serialNoBitLen = Args.range(serialNoBitLen, "serialNoBitLen", 63, 159);
this.nextCrlNumber = Args.positive(nextCrlNumber, "nextCrlNumber");
this.caUris = (caUris == null) ? CaUris.EMPTY_INSTANCE : caUris;
}
内容来源于网络,如有侵权,请联系作者删除!