public HourMinute(final int hour, final int minute) { this.hour = ParamUtil.requireRange("hour", hour, 0, 23); this.minute = ParamUtil.requireRange("minute", minute, 0, 59); }
public void setSerialNoBitLen(final Integer serialNoBitLen) { if (serialNoBitLen != null) { ParamUtil.requireRange("serialNoBitLen", serialNoBitLen, 63, 159); } this.serialNoBitLen = serialNoBitLen; }
public IssuerHash(final HashAlgoType hashAlgo, final byte[] issuerNameHash, final byte[] issuerKeyHash) { this.hashAlgo = ParamUtil.requireNonNull("hashAlgo", hashAlgo); this.issuerNameHash = ParamUtil.requireNonNull("issuerNameHash", issuerNameHash); this.issuerKeyHash = ParamUtil.requireNonNull("issuerKeyHash", issuerKeyHash); final int len = hashAlgo.length(); ParamUtil.requireRange("issuerNameHash.length", issuerNameHash.length, len, len); ParamUtil.requireRange("issuerKeyHash.length", issuerKeyHash.length, len, len); }
public static byte[] EMSA_PKCS1_v1_5_encoding(final byte[] hashValue, final int modulusBigLength, final HashAlgoType hashAlgo) throws XiSecurityException { ParamUtil.requireNonNull("hashValue", hashValue); ParamUtil.requireNonNull("hashAlgo", hashAlgo); final int hashLen = hashAlgo.length(); ParamUtil.requireRange("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; }
private ExtensionExistence(final 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(); ParamUtil.requireRange("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) { List<ASN1ObjectIdentifier> list = Collections.emptyList(); needExtensions = Collections.unmodifiableList(list); } if (wantExtensions == null) { List<ASN1ObjectIdentifier> list = Collections.emptyList(); wantExtensions = Collections.unmodifiableList(list); } } // constructor
private void init(final int serialNoBitLen, final long nextCrlNumber, final X509CaUris caUris, final int numCrls) throws CaMgmtException { this.numCrls = ParamUtil.requireMin("numCrls", numCrls, 1); this.serialNoBitLen = ParamUtil.requireRange("serialNoBitLen", serialNoBitLen, 63, 159); this.nextCrlNumber = ParamUtil.requireMin("nextCrlNumber", nextCrlNumber, 1); this.cacertUris = caUris.cacertUris(); this.ocspUris = caUris.ocspUris(); this.crlUris = caUris.crlUris(); this.deltaCrlUris = caUris.deltaCrlUris(); }
protected X509CaEntry getCaEntry() throws Exception { ParamUtil.requireRange("sn-bitlen", snBitLen, 63, 159);
ParamUtil.requireRange("sn-bitlen", snBitLen, 63, 159); entry.setSerialNoBitLen(snBitLen);