WS-Management > Support for WS-Management in Intel AMT > DSP0230: WS-CIM Mapping Specification
CollapseAll image

DSP0230: WS-CIM Mapping Specification

As stated in the specification introduction:
“This specification provides the normative rules and recommendations that describe the structure of the XML Schema, WSDL fragments, and metadata fragments that correspond to the elements of CIM models, and the representation of CIM instances as XML instance documents.”

Intel AMT follows these rules and recommendations. Here are some specifics of interest:

Base 64 formatting

Intel AMT complies with the Mapping Specification for representing octet strings in base 64. Intel AMT follows the definition in http://www.w3.org/TR/xmlschema11-2/#base64Binary.

According to this definition, there are only specific characters which can come before the base64 padding at the end of base64 format encoded data.

   If there is no “=” padding – there are no base64 character restrictions.

   If there is one “=” – the character before the padding must be one of [AEIMQUYcgkosw048].

   If there are two “=” - the character before the padding must be one of [AQgw].

The standard does not allow for special or control characters in the base 64 string. As the standard states, “The ·lexical representations· of base64Binary values are limited to the 65 characters of the Base64 Alphabet defined in [RFC 3548], i.e., a-z, A-Z, 0-9, the plus sign (+), the forward slash (/) and the equal sign (=), together with the space character (#x20). No other characters are allowed.”

Before Release 7.0, Intel AMT did not enforce these rules, resulting in a possible misinterpretation of the string. Starting with Release 7.0, a base64-encoded string that does not comply with these rules will be rejected.

For example, the GUID 03020100-0504-0706-0809-0A0B0C0D0E0F converts to “AAECAwQFBgcICQoLDA0ODw==” in  Base64.

 

Script demonstrating Hex to Base 64 conversion

The following script demonstrates a hex to base 64 conversion: It gets a hex string as an argument and returns a base64 string.

#this script receives a hex string as an argument

 

$hexChars = "0123456789ABCDEF"

 

$hexTable  =   (("0","0000"),

                ("1","0001"),

                ("2","0010"),

                ("3","0011"),

                ("4","0100"),

                ("5","0101"),

                ("6","0110"),

                ("7","0111"),

                ("8","1000"),

                ("9","1001"),

                ("A","1010"),

                ("B","1011"),

                ("C","1100"),

                ("D","1101"),

                ("E","1110"),

                ("F","1111"))

 

 

$base64Table = (("A","000000"),

                ("B","000001"),

                ("C","000010"),

                ("D","000011"),

                ("E","000100"),

                ("F","000101"),

                ("G","000110"),

                ("H","000111"),

                ("I","001000"),

                ("J","001001"),

                ("K","001010"),

                ("L","001011"),

                ("M","001100"),

                ("N","001101"),

                ("O","001110"),

                ("P","001111"),

                ("Q","010000"),

                ("R","010001"),

                ("S","010010"),

                ("T","010011"),

                ("U","010100"),

                ("V","010101"),

                ("W","010110"),

                ("X","010111"),

                ("Y","011000"),

                ("Z","011001"),

                ("a","011010"),

                ("b","011011"),

                ("c","011100"),

                ("d","011101"),

                ("e","011101"),

                ("f","011111"),

                ("g","100000"),

                ("h","100001"),

                ("i","100010"),

                ("j","100011"),

                ("k","100100"),

                ("l","100101"),

                ("m","100110"),

                ("n","100111"),

                ("o","101000"),

                ("p","101001"),

                ("q","101010"),

                ("r","101011"),

                ("s","101100"),

                ("t","101101"),

                ("u","101110"),

                ("v","101111"),

                ("w","110000"),

                ("x","110001"),

                ("y","110010"),

                ("z","110011"),

                ("0","110100"),

                ("1","110101"),

                ("2","110110"),

                ("3","110111"),

                ("4","111000"),

                ("5","111001"),

                ("6","111010"),

                ("7","111011"),

                ("8","111100"),

                ("9","111101"),

                ("+","111110"),

                ("/","111111"))

 

#converts one hex char to binary

function HexCharToBin ([string]$ch)

{

  for($i = 0; $i -lt $hexTable.Count; $i++)

  {

    if ($ch -eq $hexTable[$i][0])

    {

          return $hexTable[$i][1]

    }

  }

  throw "'{0}' is not a hex character." -f $ch

}

 

#converts hex chars to binary

function HexStrToBin ([string]$str)

{

  $result = ""

  foreach ($ch in $str.ToCharArray())

  {

    $result += HexCharToBin($ch)

  }

  return $result

}

 

#converts 6 bit chars to base64 char

function BinToBase64Char([string]$bin)

{

  for ($i = 0; $i -lt $base64Table.Count; $i++)

  {

    if ($bin -eq $base64Table[$i][1])

    {

          return $base64Table[$i][0]

    }

  }

  throw "Binary sequence is invalid" #needs to be 6 bit characters

}

 

#converts a multiplication of 6 bit chars

function BinToBase64Str ([string]$bin)

{

  if ($bin.Length % 6 -ne 0)

  {

    throw "Invalid binary length."

  }

  [string]$result = ""

  $binArray = $bin.ToCharArray()

  for($i = 0; $i -lt $bin.Length; $i+=6)

  {

    $BinCh = $binArray[$i] + $binArray[$i+1]+ $binArray[$i+2]+ $binArray[$i+3]+ $binArray[$i+4]+ $binArray[$i+5]

    $result += BinToBase64Char ($BinCh)

  }

  return $result

}

 

 

#remove spaces

[string]$hexInput = $args

$hexInput = $hexInput.Trim().Replace(" ","")

 

#region check if input is valid

 

#1. length is even - for hex

if ($hexInput.Length % 2 -eq 1)

{

  throw "Invalid input - needs to be even string."

}

 

#2. only legal chars

foreach($ch in $hexInput.ToCharArray())

{

  $legal = 0

  foreach($hexCh in $hexChars.ToCharArray())

  {

    if( $ch -eq $hexCh)

    {

          $legal = 1

          break

    }

  }

  if ($legal -eq 0)

  {

    throw "Invalid input - some of the argument characters are not hex characters."

  }

}

#endregion

 

 

[Char[]]$hexArr = $hexInput.ToCharArray() #array of hex characters

[string]$base64Result = ""

 

for ($i = 0; $i -lt $hexInput.Length; $i+=6)

{

  if($hexInput.Length - $i -ge 6) #check if there are at least 3 bytes left

  {

    $hexSection = $hexArr[$i]+$hexArr[$i+1]+$hexArr[$i+2]+$hexArr[$i+3]+$hexArr[$i+4]+$hexArr[$i+5]

    $base64Result += (BinToBase64Str (HexStrToBin $hexSection))

  }

  else

  {

    switch ($hexInput.Length  % 6)

    {

          2 #one byte left at the end (2 hex chars)

          {

                $hexSection = $hexArr[$i]+$hexArr[$i+1]

                [string]$temp = (BinToBase64Str ((HexStrToBin $hexSection)+"0000"))

                $base64Result += $temp.get_Chars(0)+$temp.get_Chars(1)+"=="

          }

          4 #two bytes left at the end (4 hex chars)

          {

                $hexSection = $hexArr[$i]+$hexArr[$i+1]+$hexArr[$i+2]+$hexArr[$i+3]

                 [string]$temp = (BinToBase64Str ((HexStrToBin $hexSection)+"00"))

                $base64Result += $temp.get_Chars(0)+$temp.get_Chars(1)+$temp.get_Chars(2)+"="

          }

    }

  }

}

write-host $base64Result

 

cimDateTime

DSP0230 defines five possible formats for cimDateTime. The details of the formats are specified in http://www.w3.org/TR/xmlschema-2. Intel AMT implements two of these formats - the xs:dateTime and xs:duration formats. The duration format is referred to as “interval” in the SDK. Using any of the other formats will result in an “unsupported format” error. The formats are used as part of the alarm clock functionality. Intel AMT requires the xs:dateTime to contain a timezone value (always “Z”) and always returns “Z”.

Copyright © 2006-2022, Intel Corporation. All rights reserved.