Home | History | Annotate | Download | only in asn1

Lines Matching refs:length

50      * Primary is used for decoding indefinite length encoding
54 /** Indicates indefinite length of the current type */
60 /** Current decoded length */
61 protected int length;
76 this(encoded, 0, encoded.length);
84 * @param expectedLength expected length of full encoding, this includes
85 * identifier, length an content octets
94 // compare expected and decoded length
95 if (length != INDEFINIT_LENGTH
96 && (offset + expectedLength) != (this.offset + this.length)) {
97 throw new ASN1Exception("Wrong content length");
121 if (length != INDEFINIT_LENGTH) {
122 // input stream has definite length encoding
123 // check allocated length to avoid further reallocations
124 if (buffer.length < (length + offset)) {
125 byte[] newBuffer = new byte[length + offset];
131 throw new ASN1Exception("Decoding indefinite length encoding is not supported");
148 * Initializes tag, length, tagOffset and contentOffset variables
159 // read length
160 length = read();
161 if (length != 0x80) { // definite form
162 // long or short length form
163 if ((length & 0x80) != 0) { // long form
164 int numOctets = length & 0x7F;
170 // collect this value length
171 length = read();
174 length = (length << 8) + ch;//read();
177 if (length > 0xFFFFFF) {
182 length = INDEFINIT_LENGTH;
190 * Returns the length of the encoding
193 int length = encoding[1] & 0xFF;
195 if ((length & 0x80) != 0) { // long form
196 numOctets = length & 0x7F;
198 // collect this value length
199 length = encoding[2] & 0xFF;
201 length = (length << 8) + (encoding[i] & 0xFF);
204 // tag length long_form content
205 return 1 + 1 + numOctets + length;
214 if (length == 0) {
215 throw new ASN1Exception("ASN.1 Bitstring: wrong length. Tag at [" + tagOffset + "]");
226 if (length == 1 && buffer[contentOffset] != 0) {
246 // check encoded length
247 if (length == 0) {
248 throw new ASN1Exception("ASN.1 enumerated: wrong length for identifier at ["
255 if (length > 1) {
276 // check encoded length
277 if (length != 1) {
278 throw new ASN1Exception("Wrong length for ASN.1 boolean at [" + tagOffset + "]");
309 if (length != 15 && (length < 17 || length > 19)) {
315 if (length > 16) {
333 if (length > 16) {
335 times[6] = strToInt(contentOffset + 15, length - 16);
337 if (length == 17) {
339 } else if (length == 18) {
359 switch (length) {
368 throw new ASN1Exception("ASN.1 UTCTime: wrong length, identifier at " + tagOffset);
399 if (length == ASN1UTCTime.UTC_HMS) {
431 // check encoded length
432 if (length < 1) {
433 throw new ASN1Exception("Wrong length for ASN.1 integer at [" + tagOffset + "]");
439 if (length > 1) {
440 byte firstByte = buffer[offset - length];
441 byte secondByte = (byte) (buffer[offset - length + 1] & 0x80);
445 throw new ASN1Exception("Wrong content for ASN.1 integer at [" + (offset - length) + "]. An integer MUST be encoded in minimum number of octets");
477 // check encoded length
478 if (length < 1) {
479 throw new ASN1Exception("Wrong length for ASN.1 object identifier at [" + tagOffset + "]");
490 for (int i = 0; i < length; i++, ++oidElement) {
506 int endOffset = begOffset + length;
514 for (; (offset < endOffset) && (i < type.length); i++) {
519 if (!sequence.OPTIONAL[i] || (i == type.length - 1)) {
529 for (; i < type.length; i++) {
538 Object[] values = new Object[type.length];
539 for (; (offset < endOffset) && (i < type.length); i++) {
544 if (!sequence.OPTIONAL[i] || (i == type.length - 1)) {
558 for (; i < type.length; i++) {
572 throw new ASN1Exception("Wrong encoding at [" + begOffset + "]. Content's length and encoded length are not the same");
611 int endOffset = begOffset + length;
636 throw new ASN1Exception("Wrong encoding at [" + begOffset + "]. Content's length and encoded length are not the same");
662 System.arraycopy(buffer, tagOffset, encoded, 0, encoded.length);
674 * Returns length of the current content for decoding
677 return length;
691 return offset + length;
725 * This mode is defined by reading a length
734 if (offset == buffer.length) {
757 if (offset + length > buffer.length) {
762 offset += length;
764 int bytesRead = in.read(buffer, offset, length);
766 if (bytesRead != length) {
771 if (c < 1 || bytesRead > length) {
774 c = in.read(buffer, offset + bytesRead, length - bytesRead);
776 } while (bytesRead != length);
779 offset += length;
788 if (offset != buffer.length) {
804 for (; i < pool[0].length && pool[0][i] != null; i++) {
811 if (i == pool[0].length) {
812 Object[][] newPool = new Object[pool[0].length * 2][2];
813 System.arraycopy(pool[0], 0, newPool[0], 0, pool[0].length);
814 System.arraycopy(pool[1], 0, newPool[1], 0, pool[0].length);
827 for (int i = 0; i < pool[0].length; i++) {