aboutsummaryrefslogtreecommitdiff
path: root/pyasn1_modules/rfc2634.py
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2019-07-31 10:36:45 +0200
committerGitHub <noreply@github.com>2019-07-31 10:36:45 +0200
commit3e2e4419553287df3f6a4071b49c6049f78be4be (patch)
tree5385178e4699ee2fe1b1c4ce446564aefde5a1f2 /pyasn1_modules/rfc2634.py
parenta2a8bbbcf2dff6e625ce6d601f1af9e84270c049 (diff)
downloadpyasn1-modules-3e2e4419553287df3f6a4071b49c6049f78be4be.tar.gz
Make SIZE OF constraint operational (#46)
Changes `ValueSizeConstraint` erroneously applied to `SequenceOf` and `SetOf` objects via `subtypeConstraint` attribute to be applied via `sizeSpec` attribute. Although `sizeSpec` takes the same constraint objects as `subtypeConstraint`, the former is only verified on de/serialization i.e. when the [constructed] object at hand is fully populated, while the latter is applied to [scalar] types at the moment of instantiation. This change also bumps pyasn1 requirement to 0.4.6.
Diffstat (limited to 'pyasn1_modules/rfc2634.py')
-rw-r--r--pyasn1_modules/rfc2634.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/pyasn1_modules/rfc2634.py b/pyasn1_modules/rfc2634.py
index 336ae64..4b4e5bb 100644
--- a/pyasn1_modules/rfc2634.py
+++ b/pyasn1_modules/rfc2634.py
@@ -101,11 +101,11 @@ MLReceiptPolicy.componentType = namedtype.NamedTypes(
tag.tagClassContext, tag.tagFormatSimple, 0))),
namedtype.NamedType('insteadOf', univ.SequenceOf(
componentType=GeneralNames()).subtype(
- subtypeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
namedtype.NamedType('inAdditionTo', univ.SequenceOf(
componentType=GeneralNames()).subtype(
- subtypeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
+ sizeSpec=constraint.ValueSizeConstraint(1, MAX)).subtype(
implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
)
@@ -123,7 +123,7 @@ class MLExpansionHistory(univ.SequenceOf):
pass
MLExpansionHistory.componentType = MLData()
-MLExpansionHistory.subtypeSpec=constraint.ValueSizeConstraint(1, ub_ml_expansion_history)
+MLExpansionHistory.sizeSpec = constraint.ValueSizeConstraint(1, ub_ml_expansion_history)
# ESS Security Label Attribute
@@ -182,7 +182,7 @@ class SecurityCategories(univ.SetOf):
pass
SecurityCategories.componentType = SecurityCategory()
-SecurityCategories.subtypeSpec=constraint.ValueSizeConstraint(1, ub_security_categories)
+SecurityCategories.sizeSpec = constraint.ValueSizeConstraint(1, ub_security_categories)
class ESSSecurityLabel(univ.Set):
@@ -282,7 +282,7 @@ class ReceiptRequest(univ.Sequence):
ReceiptRequest.componentType = namedtype.NamedTypes(
namedtype.NamedType('signedContentIdentifier', ContentIdentifier()),
namedtype.NamedType('receiptsFrom', ReceiptsFrom()),
- namedtype.NamedType('receiptsTo', univ.SequenceOf(componentType=GeneralNames()).subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_receiptsTo)))
+ namedtype.NamedType('receiptsTo', univ.SequenceOf(componentType=GeneralNames()).subtype(sizeSpec=constraint.ValueSizeConstraint(1, ub_receiptsTo)))
)
# Receipt Content Type