PrintableString type

class pyasn1.type.char.PrintableString(value=NoValue(), tagSet=TagSet(), subtypeSpec=ConstraintsIntersection())
clone(value=NoValue(), tagSet=None, subtypeSpec=None, encoding=None, binValue=NoValue(), hexValue=NoValue())

Creates a copy of OCTET STRING object representing ASN.1 type or value.

If additional parameters are specified, they will be used in resulting object instead of corresponding parameters of current object.

Parameters:
  • value (str, bytes or OctetString object) – Initialization value to pass to new ASN.1 object instead of inheriting one from the caller.
  • tagSet (TagSet) – Object representing ASN.1 tag(s) to use in new object instead of inheriting from the caller
  • subtypeSpec (ConstraintsIntersection) – Object representing ASN.1 subtype constraint(s) to use in new object instead of inheriting from the caller
  • encoding (str) – Unicode codec ID to encode/decode unicode (Python 2) or str (Python 3) the payload when OctetString object is used in string context.
  • binValue (str) – Binary string initializer. Example: ‘10110011’.
  • hexValue (str) – Hexadecimal string initializer. Example: ‘DEADBEEF’.
Returns:

OctetString – new instance of OCTET STRING type/value

hasValue()

Indicates that this object represents ASN.1 value rather than ASN.1 type.

The pyasn1 type objects can only participate in types comparision and serve as a blueprints for serialization codecs to resolve ambiguous types. Values can additionally participate to most of built-in Python operations.

Returns:boolTrue if object is ASN.1 value, False otherwise.
isSameTypeWith(other, matchTags=True, matchConstraints=True)

Evaluates ASN.1 types for equality.

Indicates if argument is an object of the same ASN.1 type as the calling type or not. ASN.1 tags (tag) and constraints (constraint) are considered when carrying out ASN.1 types comparision.

Parameters:other (a pyasn1 type object) – Class instance representing ASN.1 type.
Returns:boolTrue if types are the same, False otherwise.

Note

No Python inheritance relationship between pyasn1 objects is considered.

isSuperTypeOf(other, matchTags=True, matchConstraints=True)

Evaluates ASN.1 types for relationship.

Indicates if argument is an ASN.1 type that is derived from the ASN.1 type of the calling type. ASN.1 tags (tag) and constraints (constraint) are considered when carrying out ASN.1 types comparision.

Parameters:other (a pyasn1 type object) – Class instance representing ASN.1 type.
Returns:boolTrue if argument is derived from the calling type, False otherwise.

Note

No Python inheritance relationship between pyasn1 objects is considered.

prettyPrint(scope=0)

Provides human-friendly printable object representation.

Returns:str – human-friendly type and/or value representation.
subtype(value=NoValue(), implicitTag=None, explicitTag=None, subtypeSpec=None, encoding=None, binValue=NoValue(), hexValue=NoValue())

Creates a copy of OCTET STRING object representing ASN.1 subtype or a value.

If additional parameters are specified, they will be merged with the ones of the caller, then applied to newly created object.

Parameters:
  • value (str, bytes or OctetString object) – Initialization value to pass to new ASN.1 object instead of inheriting one from the caller.
  • implicitTag (Tag) – Implicitly apply given ASN.1 tag object to caller’s TagSet, then use the result as new object’s ASN.1 tag(s).
  • explicitTag (Tag) – Explicitly apply given ASN.1 tag object to caller’s TagSet, then use the result as new object’s ASN.1 tag(s).
  • subtypeSpec (ConstraintsIntersection) – Add ASN.1 constraints object to one of the caller, then use the result as new object’s ASN.1 constraints.
  • encoding (str) – Unicode codec ID to encode/decode unicode (Python 2) or str (Python 3) the payload when OctetString object is used in string context.
  • binValue (str) – Binary string initializer. Example: ‘10110011’.
  • hexValue (str) – Hexadecimal string initializer. Example: ‘DEADBEEF’.
Returns:

OctetString – new instance of OCTET STRING type/value