Methods Summary |
---|
public final int | next()
int tag = super.next();
if (length == INDEFINIT_LENGTH) {
throw new ASN1Exception(Messages.getString("security.105")); //$NON-NLS-1$
}
// FIXME add check: length encoding uses minimum number of octets
return tag;
|
public void | readBitString()
if (tag == ASN1Constants.TAG_C_BITSTRING) {
throw new ASN1Exception(Messages.getString("security.106", tagOffset)); //$NON-NLS-1$
}
super.readBitString();
//check: unused bits values - MUST be 0
if (length > 1
&& buffer[contentOffset] != 0
&& (buffer[offset - 1] & UNUSED_BITS_MASK[buffer[contentOffset] - 1]) != 0) {
throw new ASN1Exception(Messages.getString("security.107", contentOffset)); //$NON-NLS-1$
}
|
public void | readBoolean()
super.readBoolean();
// check encoded content
if (buffer[contentOffset] != 0 && buffer[contentOffset] != (byte) 0xFF) {
throw new ASN1Exception(Messages.getString("security.108", contentOffset)); //$NON-NLS-1$
}
|
public void | readGeneralizedTime()
if (tag == ASN1Constants.TAG_C_GENERALIZEDTIME) {
// It is a string type and it can be encoded as primitive or constructed.
throw new ASN1Exception(Messages.getString("security.10D", tagOffset)); //$NON-NLS-1$
}
super.readGeneralizedTime();
// FIXME makes sense only if we support all GeneralizedTime formats
// late check syntax: the last char MUST be Z
//if (buffer[offset - 1] != 'Z') {
// throw new ASN1Exception(
// "ASN.1 GeneralizedTime wrongly encoded at ["
// + contentOffset + ']');
//}
// the fractional-seconds elements, if present MUST
// omit all trailing zeros
// FIXME implement me
// if () {
// throw new IOException(
// "DER ASN.1 GeneralizedTime wrongly encoded at ["
// + contentOffset
// + "]. Trailing zeros MUST be omitted");
// }
|
public void | readOctetString()
if (tag == ASN1Constants.TAG_C_OCTETSTRING) {
throw new ASN1Exception(
Messages.getString("security.109", tagOffset)); //$NON-NLS-1$
}
super.readOctetString();
|
public void | readSequence(ASN1Sequence sequence)
//
// According to ASN.1 DER spec. sequence MUST not include
// any encoding which value is equal to its default value
//
// Verification of this assertion is not implemented
//
super.readSequence(sequence);
|
public void | readSetOf(ASN1SetOf setOf)
//
// According to ASN.1 DER spec. set of MUST appear in
// ascending order (short component are padded for comparison)
//
// Verification of this assertion is not implemented
//
super.readSetOf(setOf);
|
public void | readString(ASN1StringType type)
if (tag == type.constrId) {
throw new ASN1Exception(Messages.getString("security.10A", tagOffset)); //$NON-NLS-1$
}
super.readString(type);
|
public void | readUTCTime()
if (tag == ASN1Constants.TAG_C_UTCTIME) {
// It is a string type and it can be encoded as primitive or constructed.
throw new ASN1Exception(Messages.getString("security.10B", tagOffset)); //$NON-NLS-1$
}
// check format: DER uses YYMMDDHHMMSS'Z' only
if (length != ASN1UTCTime.UTC_HMS) {
throw new ASN1Exception(Messages.getString("security.10C", tagOffset)); //$NON-NLS-1$
}
super.readUTCTime();
|