github.com/trustbloc/kms-go@v1.1.2/spi/secretlock/secretlock.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  SPDX-License-Identifier: Apache-2.0
     4  */
     5  
     6  // Package secretlock provides the API for secret lock services, used to secure keys used by Aries KMS implementations.
     7  package secretlock
     8  
     9  // Service provides crypto service used internally by the KMS
    10  // it is responsible for wrapping/unwrapping keys stored by the KMS using a master key.
    11  type Service interface {
    12  	// Encrypt req for master key in keyURI
    13  	Encrypt(keyURI string, req *EncryptRequest) (*EncryptResponse, error)
    14  	// Decrypt req for master key in keyURI
    15  	Decrypt(keyURI string, req *DecryptRequest) (*DecryptResponse, error)
    16  }
    17  
    18  // EncryptRequest for encrypting remote kms requests.
    19  type EncryptRequest struct {
    20  	Plaintext                   string
    21  	AdditionalAuthenticatedData string
    22  }
    23  
    24  // DecryptRequest for decrypting remote kms requests.
    25  type DecryptRequest struct {
    26  	Ciphertext                  string
    27  	AdditionalAuthenticatedData string
    28  }
    29  
    30  // EncryptResponse for receiving encryption response from remote kms requests.
    31  type EncryptResponse struct {
    32  	Ciphertext string
    33  }
    34  
    35  // DecryptResponse for receiving decryption response from remote kms requests.
    36  type DecryptResponse struct {
    37  	Plaintext string
    38  }