ltm rule command ASN1 decode
iRule(1) BIG-IP TMSH Manual iRule(1)
ASN1::decode
Decodes ASN.1 records.
SYNOPSIS
ASN1::decode ELEMENT FORMAT (VAR_NAME)*
DESCRIPTION
This command is used to decode ASN.1 records. element specifies the
data to decode. It can be either a byte array (like is returned from
TCP::payload), or an element object returned by one of the other
commands. The bytes are decoded according to formatString, and the
results are stored in variables whose names are provided as command
arguments. If a variable with a name specified doesn't exist, it will
be created in the current scope. If the variable does exist, it's value
will be overwritten. The command returns the number of elements
decoded. If decoding iteratively, you will likely want to use
ASN1::element next with this returned value to move to the next
appropriate element for further decoding.
formatString can have the following characters:
* a - Octet String
* B - Bit String
* b - Boolean
* e - Enum
* i - Integer
* l - Length of next element
* t - Tag of next element
* x - Skip Element. No corresponding parameter is specified
* ? - Don't output the component if the corresponding value is empty
* ?hex-tag - Denotes that the specifier which follows is for an
optional component. This is used for encoding or decoding an ASN.1
Set or Sequence which contains nested OPTIONAL or DEFAULT
components. hex-tag, is a two-character hex byte of the expected
tag. When used with the decode command, if the component
corresponding to the optional specifier is not found, the
corresponding tcl variable will be unset. This allows the iRule to
use the Tcl info exists command to test the variable to determine
if the component was found. See the following section for more
details and examples.
* ( - Begin Sequence. No corresponding parameter is specified. The
initial sequence tag and length are skipped.
* ) - End Sequence. No corresponding parameter is specified.
* < - Begin Set. No corresponding parameter is specified. The initial
sequence tag and length are skipped.
* > - End Set. No corresponding parameter is specified.
RETURN VALUE
VALID DURING
EXAMPLES
ASN1::decode $ele "?a?aa?b" ruleId type matchValue dnAttrs
if {![info exists ruleId] && ![info exists type]} {
log local0. "ERR: extensibleMatch must contain either a matchingRule or type component"
}
# Handle default value for dnAttributes component
if {![info exists dnAttrs]} {
set dnAttrs 0
}
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-11.5.0 --First introduced the command.
BIG-IP 2017-01-31 iRule(1)