/** * Creates a new uuid type. * * @param item to DER encode */ public UuidType(final UUID item) { super(UniversalDERTag.OCTSTR); derItem = toBytes(item); }
@Override public byte[] encode() { return encode(derItem); }
/** * Converts bytes in the buffer to a uuid by reading from the current position to the limit. * * @param encoded buffer containing DER-encoded data where the buffer is positioned at the start of uuid bytes and * the limit is set beyond the last byte of uuid data. * * @return decoded bytes as a uuid. */ public static UUID decode(final ByteBuffer encoded) { final ByteBuffer buffer = ByteBuffer.wrap(readBuffer(encoded)); final long mostSig = buffer.getLong(); final long leastSig = buffer.getLong(); return new UUID(mostSig, leastSig); }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { if (encoded.hasRemaining()) { getObject().setEntryUuid(UuidType.decode(encoded)); } } }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { if (encoded.hasRemaining()) { getObject().setEntryUuid(UuidType.decode(encoded)); } } }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { getObject().getEntryUuids().add(UuidType.decode(encoded)); } }
/** * Creates a new uuid type. * * @param item to DER encode */ public UuidType(final UUID item) { super(UniversalDERTag.OCTSTR); derItem = toBytes(item); }
@Override public byte[] encode() { return encode(derItem); }
/** * Converts bytes in the buffer to a uuid by reading from the current position to the limit. * * @param encoded buffer containing DER-encoded data where the buffer is positioned at the start of uuid bytes and * the limit is set beyond the last byte of uuid data. * * @return decoded bytes as a uuid. */ public static UUID decode(final ByteBuffer encoded) { final ByteBuffer buffer = ByteBuffer.wrap(readBuffer(encoded)); final long mostSig = buffer.getLong(); final long leastSig = buffer.getLong(); return new UUID(mostSig, leastSig); }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { getObject().getEntryUuids().add(UuidType.decode(encoded)); } }
/** * Creates a new uuid type. * * @param item to DER encode */ public UuidType(final UUID item) { super(UniversalDERTag.OCTSTR); derItem = toBytes(item); }
@Override public byte[] encode() { return encode(derItem); }
/** * Converts bytes in the buffer to a uuid by reading from the current position to the limit. * * @param encoded buffer containing DER-encoded data where the buffer is positioned at the start of uuid bytes and * the limit is set beyond the last byte of uuid data. * * @return decoded bytes as a uuid. */ public static UUID decode(final ByteBuffer encoded) { final ByteBuffer buffer = ByteBuffer.wrap(readBuffer(encoded)); final long mostSig = buffer.getLong(); final long leastSig = buffer.getLong(); return new UUID(mostSig, leastSig); }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { getObject().getEntryUuids().add(UuidType.decode(encoded)); } }
/** * Creates a new uuid type. * * @param tag der tag associated with this type * @param item to DER encode * * @throws IllegalArgumentException if the der tag is constructed */ public UuidType(final DERTag tag, final UUID item) { super(tag); if (tag.isConstructed()) { throw new IllegalArgumentException("DER tag must not be constructed"); } derItem = toBytes(item); }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { if (encoded.hasRemaining()) { getObject().setEntryUuid(UuidType.decode(encoded)); } } }
/** * Creates a new uuid type. * * @param tag der tag associated with this type * @param item to DER encode * * @throws IllegalArgumentException if the der tag is constructed */ public UuidType(final DERTag tag, final UUID item) { super(tag); if (tag.isConstructed()) { throw new IllegalArgumentException("DER tag must not be constructed"); } derItem = toBytes(item); }
/** * @param bytes to decode. * @param expected uuid to compare. * * @throws Exception On test failure. */ @Test(groups = {"asn1"}, dataProvider = "uuids") public void decode(final byte[] bytes, final UUID expected) throws Exception { Assert.assertEquals(UuidType.decode(ByteBuffer.wrap(bytes)), expected); }
/** * Creates a new uuid type. * * @param tag der tag associated with this type * @param item to DER encode * * @throws IllegalArgumentException if the der tag is constructed */ public UuidType(final DERTag tag, final UUID item) { super(tag); if (tag.isConstructed()) { throw new IllegalArgumentException("DER tag must not be constructed"); } derItem = toBytes(item); }
ctl = new SyncStateControl( SyncStateControl.State.valueOf(c.getSyncStateType().getValue()), UuidType.decode(ByteBuffer.wrap(c.getEntryUUID())), c.getCookie(), c.isCritical());