/** * Creates a new context type. * * @param index of this item in the context * @param item to encode */ public ContextType(final int index, final byte[] item) { super(new ContextDERTag(index, false)); derItem = item; }
/** * Creates a new context type. * * @param index of this item in the context * @param item to encode */ public ContextType(final int index, final byte[] item) { super(new ContextDERTag(index, false)); derItem = item; }
/** * Creates a new context type. * * @param index of this item in the context * @param item to encode */ public ContextType(final int index, final byte[] item) { super(new ContextDERTag(index, false)); derItem = item; }
tag = new ContextDERTag(tagNo, constructed); break;
tag = new ContextDERTag(tagNo, constructed); break;
tag = new ContextDERTag(tagNo, constructed); break;
@Override public byte[] encode() { final List<DEREncoder> l = new ArrayList<>(); if (getAssertionValue() != null) { l.add(new IntegerType(getBeforeCount())); l.add(new IntegerType(getAfterCount())); l.add(new OctetStringType(new ContextDERTag(1, false), getAssertionValue())); if (getContextID() != null) { l.add(new OctetStringType(getContextID())); } } else { l.add(new IntegerType(getBeforeCount())); l.add(new IntegerType(getAfterCount())); l.add( new ConstructedDEREncoder( new ContextDERTag(0, true), new IntegerType(getTargetOffset()), new IntegerType(getContentCount()))); if (getContextID() != null) { l.add(new OctetStringType(getContextID())); } } final ConstructedDEREncoder se = new ConstructedDEREncoder( UniversalDERTag.SEQ, l.toArray(new DEREncoder[l.size()])); return se.encode(); } }
@Override public byte[] encode() { final List<DEREncoder> l = new ArrayList<>(); if (getAssertionValue() != null) { l.add(new IntegerType(getBeforeCount())); l.add(new IntegerType(getAfterCount())); l.add(new OctetStringType(new ContextDERTag(1, false), getAssertionValue())); if (getContextID() != null) { l.add(new OctetStringType(getContextID())); } } else { l.add(new IntegerType(getBeforeCount())); l.add(new IntegerType(getAfterCount())); l.add( new ConstructedDEREncoder( new ContextDERTag(0, true), new IntegerType(getTargetOffset()), new IntegerType(getContentCount()))); if (getContextID() != null) { l.add(new OctetStringType(getContextID())); } } final ConstructedDEREncoder se = new ConstructedDEREncoder( UniversalDERTag.SEQ, l.toArray(new DEREncoder[l.size()])); return se.encode(); } }
@Override public byte[] encode() { final List<DEREncoder> l = new ArrayList<>(); if (getAssertionValue() != null) { l.add(new IntegerType(getBeforeCount())); l.add(new IntegerType(getAfterCount())); l.add(new OctetStringType(new ContextDERTag(1, false), getAssertionValue())); if (getContextID() != null) { l.add(new OctetStringType(getContextID())); } } else { l.add(new IntegerType(getBeforeCount())); l.add(new IntegerType(getAfterCount())); l.add( new ConstructedDEREncoder( new ContextDERTag(0, true), new IntegerType(getTargetOffset()), new IntegerType(getContentCount()))); if (getContextID() != null) { l.add(new OctetStringType(getContextID())); } } final ConstructedDEREncoder se = new ConstructedDEREncoder( UniversalDERTag.SEQ, l.toArray(new DEREncoder[l.size()])); return se.encode(); } }