Package nss :: Module nss :: Class SecItem
[hide private]
[frames] | no frames]

Class SecItem

object --+
         |
        SecItem

SecItem(data=None, type=siBuffer)

:Parameters:
    data : any read buffer compatible object (e.g. buffer or string)
        raw data to initialize from
    type : int
        SECItemType constant (e.g. si*)

Encoded data. Used internally by NSS

Instance Methods [hide private]
 
__cmp__(x, y)
cmp(x,y)
 
__getitem__(x, y)
x[y]
 
__getslice__(x, i, j)
x[i:j]
 
__init__(data=None, type=siBuffer)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__len__(x)
len(x)
a new object with type S, a subtype of T

__new__(T, S, ...)
 
__repr__(x)
repr(x)
 
__str__(x)
str(x)
string or list of strings

der_to_hex(octets_per_line=0, separator=':')
:Parameters: octets_per_line : integer Number of octets formatted on one line, if 0 then return a single string instead of an array of lines separator : string String used to seperate each octet If None it will be as if the empty string had been passed and no separator will be used.
(obj, ...)

get_oid_sequence(sec_item, repr_kind=AsString)
:Parameters: sec_item : SecItem object A SecItem containing a DER encoded sequence of OID's repr_kind : RepresentationKind constant Specifies what the contents of the returned tuple will be.
string or list of strings

to_hex(octets_per_line=0, separator=':')
:Parameters: octets_per_line : integer Number of octets formatted on one line, if 0 then return a single string instead of an array of lines separator : string String used to seperate each octet If None it will be as if the empty string had been passed and no separator will be used.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]
  data
contents of SecItem buffer
  len
number of octets in SecItem buffer
  type
the SecItem type (si* constant)

Inherited from object: __class__

Method Details [hide private]

__getslice__(x, i, j)
(Slicling operator)

 
x[i:j]

Use of negative indices is not supported.

__init__(data=None, type=siBuffer)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__

__new__(T, S, ...)

 


Returns:
a new object with type S, a subtype of T

Overrides: object.__new__

__repr__(x)
(Representation operator)

 
repr(x)

Overrides: object.__repr__

__str__(x)
(Informal representation operator)

 
str(x)

Overrides: object.__str__

der_to_hex(octets_per_line=0, separator=':')

 
:Parameters:
    octets_per_line : integer
        Number of octets formatted on one line, if 0 then
        return a single string instead of an array of lines
    separator : string
        String used to seperate each octet
        If None it will be as if the empty string had been
        passed and no separator will be used.

Interpret the SecItem as containing DER encoded data consisting
of a <type,length,value> triplet (e.g. TLV). This function skips
the type and length components and returns the value component as
a hexadecimal string or a list of hexidecimal strings with a
maximum of octets_per_line in each list element. See data_to_hex()
for a more detailed explanation.

Returns:
string or list of strings

get_oid_sequence(sec_item, repr_kind=AsString)

 
:Parameters:
    sec_item : SecItem object
        A SecItem containing a DER encoded sequence of OID's
    repr_kind : RepresentationKind constant
        Specifies what the contents of the returned tuple will be.
        May be one of:

        AsObject
            Each extended key usage will be a SecItem object embedding
            the OID in DER format.
        AsString
            Each extended key usage will be a descriptive string.
            (e.g. "TLS Web Server Authentication Certificate")
        AsDottedDecimal
            Each extended key usage will be OID rendered as a dotted decimal string.
            (e.g. "OID.1.3.6.1.5.5.7.3.1")
        AsEnum
            Each extended key usage will be OID tag enumeration constant (int).
            (e.g. nss.SEC_OID_EXT_KEY_USAGE_SERVER_AUTH)

Return a tuple of OID's according the representation kind.

Returns:
(obj, ...)

to_hex(octets_per_line=0, separator=':')

 
:Parameters:
    octets_per_line : integer
        Number of octets formatted on one line, if 0 then
        return a single string instead of an array of lines
    separator : string
        String used to seperate each octet
        If None it will be as if the empty string had been
        passed and no separator will be used.

Equivalent to calling data_to_hex(sec_item)

Returns:
string or list of strings