0

有没有人在单个 kmip 请求中使用过定位和获取操作。我收到一个错误,因为它很难同时操作。正如你可以看到我发送到我的服务器的 kmip 请求。

<RequestMessage>
  <RequestHeader>
    <ProtocolVersion>
      <ProtocolVersionMajor type="Integer" value="1"/>
      <ProtocolVersionMinor type="Integer" value="2"/>
    </ProtocolVersion>
    <Authentication>
      <Credential>
        <CredentialType type="Enumeration" value="UsernameAndPassword"/>
        <CredentialValue>
          <Username type="TextString" value="vijans"/>
          <Password type="TextString" value="asdf1234"/>
        </CredentialValue>
      </Credential>
    </Authentication>
    <BatchOrderOption type="Boolean" value="1"/>
    <BatchCount type="Integer" value="2"/>
  </RequestHeader>
  <BatchItem>
    <Operation type="Enumeration" value="Locate"/>
    <UniqueBatchItemID type="ByteString" value="31303030303031"/>
    <RequestPayload>
      <Attribute>
        <AttributeName type="TextString" value="Name"/>
        <AttributeValue>
          <NameValue type="TextString" value="new_ss_nv"/>
          <NameType type="Enumeration" value="UninterpretedTextString"/>
        </AttributeValue>
      </Attribute>
    </RequestPayload>
  </BatchItem>
  <BatchItem>
    <Operation type="Enumeration" value="Get"/>
    <UniqueBatchItemID type="ByteString" value="31303030303032"/>
    <RequestPayload/>
  </BatchItem>
</RequestMessage>

这是无效的,因为 get 操作不会演变为唯一标识符的使用。可以帮助某人吗?

4

1 回答 1

2

Your KMIP server must implement the ID placeholder mechanism. It's a temporary Unique Identifier variable to cache the identifier between batch items in a request (see the Client-to-Server Operations section in the specification).

You can see for each operation how this ID placeholder must be used or saved. An extract from the Locate operation:

The server returns a list of Unique Identifiers of the found objects, which then MAY be retrieved using the Get operation. [...]. If a single Unique Identifier is returned to the client, then the server SHALL copy the Unique Identifier returned by this operation into the ID Placeholder variable. If the Locate operation matches more than one object, and the Maximum Items value is omitted in the request, or is set to a value larger than one, then the server SHALL empty the ID Placeholder, causing any subsequent operations that are batched with the Locate, and which do not specify a Unique Identifier explicitly, to fail.

In the Get operation, the Get Request Payload table specifies that the Unique Identifier is not required and describes that:

If omitted, then the ID Placeholder value is used by the server as the Unique Identifier.

Then for the Locate operation, if the Locate results with one single Unique Identifier, the server must cache the value in the ID placeholder (independently of the next operation), else it must empty the ID placeholder.

Finally for the Get operation, if the Unique Identifier is not defined in the request, the server must make the operation with the ID placeholder. If the ID placeholder is empty, the operation must fail with a result like "Invalid Field" (i'm not sure about that result reason but that makes sense to me).

于 2018-11-24T17:42:45.970 回答