summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelie <elie>2013-09-01 19:51:12 +0000
committerelie <elie>2013-09-01 19:51:12 +0000
commita8bc9a468c0743bc83612885c3cfcf9b9c6f21d2 (patch)
tree28dab87d7c2b7012832bd6ca63ae9f51b9814817
parentead8167dab7a565a3cc463b5b8976f5860dfeb4e (diff)
downloadpyasn1-a8bc9a468c0743bc83612885c3cfcf9b9c6f21d2.tar.gz
ObjectDescriptor type added
-rw-r--r--CHANGES1
-rw-r--r--pyasn1/codec/ber/decoder.py3
-rw-r--r--pyasn1/codec/ber/encoder.py1
-rw-r--r--pyasn1/type/char.py1
-rw-r--r--pyasn1/type/useful.py5
5 files changed, 10 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 58a8480..b90a904 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,7 @@ Revision 0.1.8
- Fix to SEQUENCE and SET types to give them their private componentTypes
collection (which is a NamedTypes object) so that they won't collide in
a MT execution environment.
+- Missing ObjectDescriptor useful type added.
- Fix to NamedType.__repr__() to work properly.
- Fix to binary initializer support of Real object.
diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py
index 6e66044..2e40e75 100644
--- a/pyasn1/codec/ber/decoder.py
+++ b/pyasn1/codec/ber/decoder.py
@@ -521,6 +521,8 @@ class BMPStringDecoder(OctetStringDecoder):
protoComponent = char.BMPString()
# "useful" types
+class ObjectDescriptorDecoder(OctetStringDecoder):
+ protoComponent = useful.ObjectDescriptor()
class GeneralizedTimeDecoder(OctetStringDecoder):
protoComponent = useful.GeneralizedTime()
class UTCTimeDecoder(OctetStringDecoder):
@@ -552,6 +554,7 @@ tagMap = {
char.UniversalString.tagSet: UniversalStringDecoder(),
char.BMPString.tagSet: BMPStringDecoder(),
# useful types
+ useful.ObjectDescriptor.tagSet: ObjectDescriptorDecoder(),
useful.GeneralizedTime.tagSet: GeneralizedTimeDecoder(),
useful.UTCTime.tagSet: UTCTimeDecoder()
}
diff --git a/pyasn1/codec/ber/encoder.py b/pyasn1/codec/ber/encoder.py
index 173949d..85afc07 100644
--- a/pyasn1/codec/ber/encoder.py
+++ b/pyasn1/codec/ber/encoder.py
@@ -308,6 +308,7 @@ tagMap = {
char.UniversalString.tagSet: OctetStringEncoder(),
char.BMPString.tagSet: OctetStringEncoder(),
# useful types
+ useful.ObjectDescriptor.tagSet: OctetStringEncoder(),
useful.GeneralizedTime.tagSet: OctetStringEncoder(),
useful.UTCTime.tagSet: OctetStringEncoder()
}
diff --git a/pyasn1/type/char.py b/pyasn1/type/char.py
index ae112f8..8cfae10 100644
--- a/pyasn1/type/char.py
+++ b/pyasn1/type/char.py
@@ -21,7 +21,6 @@ class TeletexString(univ.OctetString):
tagSet = univ.OctetString.tagSet.tagImplicitly(
tag.Tag(tag.tagClassUniversal, tag.tagFormatSimple, 20)
)
-
class VideotexString(univ.OctetString):
tagSet = univ.OctetString.tagSet.tagImplicitly(
diff --git a/pyasn1/type/useful.py b/pyasn1/type/useful.py
index a7139c2..1766534 100644
--- a/pyasn1/type/useful.py
+++ b/pyasn1/type/useful.py
@@ -1,6 +1,11 @@
# ASN.1 "useful" types
from pyasn1.type import char, tag
+class ObjectDescriptor(char.GraphicString):
+ tagSet = char.GraphicString.tagSet.tagImplicitly(
+ tag.Tag(tag.tagClassUniversal, tag.tagFormatSimple, 7)
+ )
+
class GeneralizedTime(char.VisibleString):
tagSet = char.VisibleString.tagSet.tagImplicitly(
tag.Tag(tag.tagClassUniversal, tag.tagFormatSimple, 24)