Skip to content

Commit

Permalink
Update Encryption/Decryption payloads to reflect KMIP 1.4 structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksiys authored and smira committed Aug 8, 2019
1 parent f14292f commit 76b04f5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 24 additions & 1 deletion operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,38 @@ type QueryResponse struct {
VendorIdentification string `kmip:"VENDOR_IDENTIFICATION"`
}

// EncryptRequest is an Encrypt Request Payload
type EncryptRequest struct {
UniqueIdentifier string `kmip:"UNIQUE_IDENTIFIER"`
CryptoParams CryptoParams `kmip:"CRYPTOGRAPHIC_PARAMETERS"`
Data []byte `kmip:"DATA"`
IVCounterNonce []byte `kmip:"IV_COUNTER_NONCE"`
CorrelationValue []byte `kmip:"CORRELATION_VALUE"`
InitIndicator bool `kmip:"INIT_INDICATOR"`
FinalIndicator bool `kmip:"FINAL_INDICATOR"`
AdditionalData []byte `kmip:"AUTHENTICATED_ENCRYPTION_ADDITIONAL_DATA"`
}

// EncryptResponse is a Encrypt Response Payload
type EncryptResponse struct {
UniqueIdentifier string `kmip:"UNIQUE_IDENTIFIER,required"`
Data []byte `kmip:"DATA"`
IVCounterNonce []byte `kmip:"IV_COUNTER_NONCE"`
CorrelationValue []byte `kmip:"CORRELATION_VALUE"`
AuthTag []byte `kmip:"AUTHENTICATED_ENCRYPTION_TAG"`
}

// DecryptRequest is a Decrypt Request Payload
type DecryptRequest struct {
UniqueIdentifier string `kmip:"UNIQUE_IDENTIFIER"`
CryptoParams CryptoParams `kmip:"CRYPTOGRAPHIC_PARAMETERS"`
Data []byte `kmip:"DATA"`
IVCounterNone []byte `kmip:"IV_COUNTER_NONCE"`
IVCounterNonce []byte `kmip:"IV_COUNTER_NONCE"`
CorrelationValue []byte `kmip:"CORRELATION_VALUE"`
InitIndicator bool `kmip:"INIT_INDICATOR"`
FinalIndicator bool `kmip:"FINAL_INDICATOR"`
AdditionalData []byte `kmip:"AUTHENTICATED_ENCRYPTION_ADDITIONAL_DATA"`
AuthTag []byte `kmip:"AUTHENTICATED_ENCRYPTION_TAG"`
}

// DecryptResponse is a Decrypt Response Payload
Expand Down
2 changes: 2 additions & 0 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ func (bi *ResponseBatchItem) BuildFieldValue(name string) (v interface{}, err er
v = &DestroyResponse{}
case OPERATION_DISCOVER_VERSIONS:
v = &DiscoverVersionsResponse{}
case OPERATION_ENCRYPT:
v = &EncryptResponse{}
case OPERATION_DECRYPT:
v = &DecryptResponse{}
case OPERATION_SIGN:
Expand Down

0 comments on commit 76b04f5

Please sign in to comment.