Class: QSafe::CryptographicOperationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/qsafe/api/cryptographic_operations_api.rb,
lib/qsafe-sdk/api/cryptographic_operations_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CryptographicOperationsApi

Returns a new instance of CryptographicOperationsApi.



19
20
21
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#decrypt_data(keypair_id, decrypt_request, opts = {}) ⇒ DecryptData200Response

Decrypt data with a keypair’s private key

Parameters:

  • keypair_id (String)

    UUID v4 keypair identifier

  • decrypt_request (DecryptRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 27

def decrypt_data(keypair_id, decrypt_request, opts = {})
  data, _status_code, _headers = decrypt_data_with_http_info(keypair_id, decrypt_request, opts)
  data
end

#decrypt_data_with_http_info(keypair_id, decrypt_request, opts = {}) ⇒ Array<(DecryptData200Response, Integer, Hash)>

Decrypt data with a keypair&#39;s private key

Parameters:

  • keypair_id (String)

    UUID v4 keypair identifier

  • decrypt_request (DecryptRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DecryptData200Response, Integer, Hash)>)

    DecryptData200Response data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 37

def decrypt_data_with_http_info(keypair_id, decrypt_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CryptographicOperationsApi.decrypt_data ...'
  end
  # verify the required parameter 'keypair_id' is set
  if @api_client.config.client_side_validation && keypair_id.nil?
    fail ArgumentError, "Missing the required parameter 'keypair_id' when calling CryptographicOperationsApi.decrypt_data"
  end
  # verify the required parameter 'decrypt_request' is set
  if @api_client.config.client_side_validation && decrypt_request.nil?
    fail ArgumentError, "Missing the required parameter 'decrypt_request' when calling CryptographicOperationsApi.decrypt_data"
  end
  # resource path
  local_var_path = '/keypairs/{keypairId}/decrypt'.sub('{' + 'keypairId' + '}', CGI.escape(keypair_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(decrypt_request)

  # return_type
  return_type = opts[:debug_return_type] || 'DecryptData200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyHeader', 'ApiKeyQuery', 'BearerAuth']

  new_options = opts.merge(
    :operation => :"CryptographicOperationsApi.decrypt_data",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CryptographicOperationsApi#decrypt_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#encrypt_data(keypair_id, encrypt_request, opts = {}) ⇒ EncryptData200Response

Encrypt data with a keypair’s public key Uses ML-KEM (Kyber). The keypair must use a ‘KYBER*` algorithm. Optionally stores result in ephemeral storage and returns an `ephemeral_id` for later decryption without passing raw ciphertext.

Parameters:

  • keypair_id (String)

    UUID v4 keypair identifier

  • encrypt_request (EncryptRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



100
101
102
103
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 100

def encrypt_data(keypair_id, encrypt_request, opts = {})
  data, _status_code, _headers = encrypt_data_with_http_info(keypair_id, encrypt_request, opts)
  data
end

#encrypt_data_with_http_info(keypair_id, encrypt_request, opts = {}) ⇒ Array<(EncryptData200Response, Integer, Hash)>

Encrypt data with a keypair&#39;s public key Uses ML-KEM (Kyber). The keypair must use a &#x60;KYBER*&#x60; algorithm. Optionally stores result in ephemeral storage and returns an &#x60;ephemeral_id&#x60; for later decryption without passing raw ciphertext.

Parameters:

  • keypair_id (String)

    UUID v4 keypair identifier

  • encrypt_request (EncryptRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(EncryptData200Response, Integer, Hash)>)

    EncryptData200Response data, response status code and response headers



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 111

def encrypt_data_with_http_info(keypair_id, encrypt_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CryptographicOperationsApi.encrypt_data ...'
  end
  # verify the required parameter 'keypair_id' is set
  if @api_client.config.client_side_validation && keypair_id.nil?
    fail ArgumentError, "Missing the required parameter 'keypair_id' when calling CryptographicOperationsApi.encrypt_data"
  end
  # verify the required parameter 'encrypt_request' is set
  if @api_client.config.client_side_validation && encrypt_request.nil?
    fail ArgumentError, "Missing the required parameter 'encrypt_request' when calling CryptographicOperationsApi.encrypt_data"
  end
  # resource path
  local_var_path = '/keypairs/{keypairId}/encrypt'.sub('{' + 'keypairId' + '}', CGI.escape(keypair_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(encrypt_request)

  # return_type
  return_type = opts[:debug_return_type] || 'EncryptData200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyHeader', 'ApiKeyQuery', 'BearerAuth']

  new_options = opts.merge(
    :operation => :"CryptographicOperationsApi.encrypt_data",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CryptographicOperationsApi#encrypt_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#sign_data(keypair_id, sign_request, opts = {}) ⇒ SignData200Response

Sign data with a keypair’s private key Uses ML-DSA (Dilithium). The keypair must use a ‘DILITHIUM*` algorithm.

Parameters:

  • keypair_id (String)

    UUID v4 keypair identifier

  • sign_request (SignRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



174
175
176
177
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 174

def sign_data(keypair_id, sign_request, opts = {})
  data, _status_code, _headers = sign_data_with_http_info(keypair_id, sign_request, opts)
  data
end

#sign_data_with_http_info(keypair_id, sign_request, opts = {}) ⇒ Array<(SignData200Response, Integer, Hash)>

Sign data with a keypair&#39;s private key Uses ML-DSA (Dilithium). The keypair must use a &#x60;DILITHIUM*&#x60; algorithm.

Parameters:

  • keypair_id (String)

    UUID v4 keypair identifier

  • sign_request (SignRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SignData200Response, Integer, Hash)>)

    SignData200Response data, response status code and response headers



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 185

def sign_data_with_http_info(keypair_id, sign_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CryptographicOperationsApi.sign_data ...'
  end
  # verify the required parameter 'keypair_id' is set
  if @api_client.config.client_side_validation && keypair_id.nil?
    fail ArgumentError, "Missing the required parameter 'keypair_id' when calling CryptographicOperationsApi.sign_data"
  end
  # verify the required parameter 'sign_request' is set
  if @api_client.config.client_side_validation && sign_request.nil?
    fail ArgumentError, "Missing the required parameter 'sign_request' when calling CryptographicOperationsApi.sign_data"
  end
  # resource path
  local_var_path = '/keypairs/{keypairId}/sign'.sub('{' + 'keypairId' + '}', CGI.escape(keypair_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(sign_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SignData200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyHeader', 'ApiKeyQuery', 'BearerAuth']

  new_options = opts.merge(
    :operation => :"CryptographicOperationsApi.sign_data",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CryptographicOperationsApi#sign_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#verify_signature(keypair_id, verify_request, opts = {}) ⇒ VerifySignature200Response

Verify a signature

Parameters:

  • keypair_id (String)

    UUID v4 keypair identifier

  • verify_request (VerifyRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



247
248
249
250
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 247

def verify_signature(keypair_id, verify_request, opts = {})
  data, _status_code, _headers = verify_signature_with_http_info(keypair_id, verify_request, opts)
  data
end

#verify_signature_with_http_info(keypair_id, verify_request, opts = {}) ⇒ Array<(VerifySignature200Response, Integer, Hash)>

Verify a signature

Parameters:

  • keypair_id (String)

    UUID v4 keypair identifier

  • verify_request (VerifyRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(VerifySignature200Response, Integer, Hash)>)

    VerifySignature200Response data, response status code and response headers



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/qsafe/api/cryptographic_operations_api.rb', line 257

def verify_signature_with_http_info(keypair_id, verify_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CryptographicOperationsApi.verify_signature ...'
  end
  # verify the required parameter 'keypair_id' is set
  if @api_client.config.client_side_validation && keypair_id.nil?
    fail ArgumentError, "Missing the required parameter 'keypair_id' when calling CryptographicOperationsApi.verify_signature"
  end
  # verify the required parameter 'verify_request' is set
  if @api_client.config.client_side_validation && verify_request.nil?
    fail ArgumentError, "Missing the required parameter 'verify_request' when calling CryptographicOperationsApi.verify_signature"
  end
  # resource path
  local_var_path = '/keypairs/{keypairId}/verify'.sub('{' + 'keypairId' + '}', CGI.escape(keypair_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(verify_request)

  # return_type
  return_type = opts[:debug_return_type] || 'VerifySignature200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyHeader', 'ApiKeyQuery', 'BearerAuth']

  new_options = opts.merge(
    :operation => :"CryptographicOperationsApi.verify_signature",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CryptographicOperationsApi#verify_signature\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end