@Test(groups = "asn1", dataProvider = "ints") public void decodeUnsignedPrimitive( final byte[] bytes, final BigInteger expected, final BigInteger unsigned, final int unsignedPrim) throws Exception { Assert.assertEquals(IntegerType.decodeUnsignedPrimitive(new DefaultDERBuffer(bytes)), unsignedPrim); }
public static int decodeUnsignedPrimitive(final DERBuffer encoded) { final byte[] bytes = encoded.getRemainingBytes(); if (bytes.length > 4) { throw new IllegalArgumentException("Buffer length must be <= 4 bytes"); } int i = 0; for (byte b : bytes) { i <<= 8; i |= b & 0xFF; } return i; }
IntegerType extends AbstractDERType implements DEREncoder { public static int decodeUnsignedPrimitive(final DERBuffer encoded) { final byte[] bytes = encoded.getRemainingBytes(); if (bytes.length > 4) { throw new IllegalArgumentException("Buffer length must be <= 4 bytes"); } int i = 0; for (byte b : bytes) { i <<= 8; i |= b & 0xFF; } return i; } }
IntegerType extends AbstractDERType implements DEREncoder { public static int decodeUnsignedPrimitive(final DERBuffer encoded) { final byte[] bytes = encoded.getRemainingBytes(); if (bytes.length > 4) { throw new IllegalArgumentException("Buffer length must be <= 4 bytes"); } int i = 0; for (byte b : bytes) { i <<= 8; i |= b & 0xFF; } return i; } IntegerType(final BigInteger item);  IntegerType(final int item);  IntegerType(final DERTag tag, final BigInteger item);  IntegerType(final DERTag tag, final int item); }
IntegerType extends AbstractDERType implements DEREncoder { public static int decodeUnsignedPrimitive(final DERBuffer encoded) { final byte[] bytes = encoded.getRemainingBytes(); if (bytes.length > 4) { throw new IllegalArgumentException("Buffer length must be <= 4 bytes"); } int i = 0; for (byte b : bytes) { i <<= 8; i |= b & 0xFF; } return i; } IntegerType(final BigInteger item);  IntegerType(final int item);  IntegerType(final DERTag tag, final BigInteger item);  IntegerType(final DERTag tag, final int item); @Override byte[] encode(); static BigInteger decode(final DERBuffer encoded); static BigInteger decodeUnsigned(final DERBuffer encoded); static int decodeUnsignedPrimitive(final DERBuffer encoded); static byte[] toBytes(final BigInteger i); }
IntegerType extends AbstractDERType implements DEREncoder { public static int decodeUnsignedPrimitive(final DERBuffer encoded) { final byte[] bytes = encoded.getRemainingBytes(); if (bytes.length > 4) { throw new IllegalArgumentException("Buffer length must be <= 4 bytes"); } int i = 0; for (byte b : bytes) { i <<= 8; i |= b & 0xFF; } return i; } IntegerType(final BigInteger item);  IntegerType(final int item);  IntegerType(final DERTag tag, final BigInteger item);  IntegerType(final DERTag tag, final int item); @Override byte[] encode(); static BigInteger decode(final DERBuffer encoded); static BigInteger decodeUnsigned(final DERBuffer encoded); static int decodeUnsignedPrimitive(final DERBuffer encoded); static byte[] toBytes(final BigInteger i);  }