org.xipki.util.Args.range()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.xipki.util.Args.range()方法的一些代码示例,展示了Args.range()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.range()方法的具体详情如下:
包路径:org.xipki.util.Args
类名称:Args
方法名:range

Args.range介绍

暂无

代码示例

代码示例来源:origin: org.xipki/ca-api

public void setSerialNoBitLen(Integer serialNoBitLen) {
 if (serialNoBitLen != null) {
  Args.range(serialNoBitLen, "serialNoBitLen", 63, 159);
 }
 this.serialNoBitLen = serialNoBitLen;
}

代码示例来源:origin: org.xipki/ca-api

public HourMinute(int hour, int minute) {
 this.hour = Args.range(hour, "hour", 0, 23);
 this.minute = Args.range(minute, "minute", 0, 59);
}

代码示例来源:origin: org.xipki/ca-server

public UniqueIdGenerator(long epoch, int shardId) {
 this.epoch = Args.notNegative(epoch, "epoch");
 this.shardId = Args.range(shardId, "shardId", 0, 127);
 this.accumulatorFunction = new OffsetIncrement();
}

代码示例来源:origin: org.xipki/security

public IssuerHash(HashAlgo hashAlgo, byte[] issuerNameHash, byte[] issuerKeyHash) {
 this.hashAlgo = Args.notNull(hashAlgo, "hashAlgo");
 this.issuerNameHash = Args.notNull(issuerNameHash, "issuerNameHash");
 this.issuerKeyHash = Args.notNull(issuerKeyHash, "issuerKeyHash");
 final int len = hashAlgo.getLength();
 Args.range(issuerNameHash.length, "issuerNameHash.length", len, len);
 Args.range(issuerKeyHash.length, "issuerKeyHash.length", len, len);
}

代码示例来源:origin: org.xipki/security

public static byte[] EMSA_PKCS1_v1_5_encoding(byte[] hashValue, int modulusBigLength,
  HashAlgo hashAlgo) throws XiSecurityException {
 Args.notNull(hashValue, "hashValue");
 Args.notNull(hashAlgo, "hashAlgo");
 final int hashLen = hashAlgo.getLength();
 Args.range(hashValue.length, "hashValue.length", hashLen, hashLen);
 int blockSize = (modulusBigLength + 7) / 8;
 byte[] prefix = digestPkcsPrefix.get(hashAlgo);
 if (prefix.length + hashLen + 3 > blockSize) {
  throw new XiSecurityException("data too long (maximal " + (blockSize - 3)
    + " allowed): " + (prefix.length + hashLen));
 }
 byte[] block = new byte[blockSize];
 block[0] = 0x00;
 // type code 1
 block[1] = 0x01;
 int offset = 2;
 while (offset < block.length - prefix.length - hashLen - 1) {
  block[offset++] = (byte) 0xFF;
 }
 // mark the end of the padding
 block[offset++] = 0x00;
 System.arraycopy(prefix, 0, block, offset, prefix.length);
 offset += prefix.length;
 System.arraycopy(hashValue, 0, block, offset, hashValue.length);
 return block;
}

代码示例来源:origin: xipki/xipki

public static String encryptPassword(PBEAlgo algo, int iterationCount, char[] masterPassword,
  char[] password) throws PasswordResolverException {
 Args.range(iterationCount, "iterationCount", 1, 65535);
 Args.notNull(masterPassword, "masterPassword");
 Args.notNull(password, "password");

代码示例来源:origin: org.xipki/security

private ExtensionExistence(ASN1Sequence seq) {
 int size = seq.size();
 if (size > 2) {
  throw new IllegalArgumentException("wrong number of elements in sequence");
 }
 for (int i = 0; i < size; i++) {
  ASN1TaggedObject tagObject = ASN1TaggedObject.getInstance(seq.getObjectAt(i));
  int tag = tagObject.getTagNo();
  Args.range(tag, "tag", 0, 1);
  ASN1Sequence subSeq = ASN1Sequence.getInstance(tagObject.getObject());
  List<ASN1ObjectIdentifier> oids = new LinkedList<>();
  int subSize = subSeq.size();
  for (int j = 0; j < subSize; j++) {
   oids.add(ASN1ObjectIdentifier.getInstance(subSeq.getObjectAt(j)));
  }
  if (tag == 0) {
   needExtensions = Collections.unmodifiableList(oids);
  } else {
   wantExtensions = Collections.unmodifiableList(oids);
  }
 }
 if (needExtensions == null) {
  needExtensions = Collections.unmodifiableList(Collections.emptyList());
 }
 if (wantExtensions == null) {
  wantExtensions = Collections.unmodifiableList(Collections.emptyList());
 }
} // constructor

代码示例来源:origin: org.xipki/ca-server

@Override
public List<CertListInfo> listCertificates(String caName, X500Name subjectPattern, Date validFrom,
  Date validTo, CertListOrderBy orderBy, int numEntries) throws CaMgmtException {
 caName = Args.toNonBlankLower(caName, "caName");
 Args.range(numEntries, "numEntries", 1, 1000);
 X509Ca ca = getX509Ca(caName);
 try {
  return ca.listCerts(subjectPattern, validFrom, validTo, orderBy, numEntries);
 } catch (OperationException ex) {
  throw new CaMgmtException(ex.getMessage(), ex);
 }
}

代码示例来源: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;
}

代码示例来源:origin: org.xipki.shell/ca-mgmt-shell

protected MgmtEntry.Ca getCaEntry() throws Exception {
 Args.range(snBitLen, "sn-bitlen", 63, 159);

代码示例来源:origin: org.xipki.shell/ca-mgmt-shell

Args.range(snBitLen, "sn-bitlen", 63, 159);
entry.setSerialNoBitLen(snBitLen);

相关文章