Add NULL support to Client DER library
This commit is contained in:
@@ -59,6 +59,8 @@ namespace StudySystemClient.Der {
|
||||
return new Utf8String.from_content(content);
|
||||
case Sequence.TYPE:
|
||||
return new Sequence.from_content(content);
|
||||
case Null.TYPE:
|
||||
return new Null.from_content(content);
|
||||
default:
|
||||
throw new DecodeError.UNKNOWN_TYPE("Unsupported type: %02x",
|
||||
type);
|
||||
@@ -287,4 +289,22 @@ namespace StudySystemClient.Der {
|
||||
value = decode(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
public class Null : Datum {
|
||||
internal const uint8 TYPE = 0x05;
|
||||
|
||||
public Null() {
|
||||
type = TYPE;
|
||||
content = new uint8[] {};
|
||||
}
|
||||
|
||||
internal Null.from_content(uint8[] bytes) throws DecodeError {
|
||||
if (bytes.length != 0) {
|
||||
throw new DecodeError.INVALID_CONTENT(
|
||||
"Non-empty content for NULL");
|
||||
}
|
||||
type = TYPE;
|
||||
content = bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user