254
255
256
257
258
259
260
261
262
263
264
265
266
|
# File 'lib/rubythemis.rb', line 254
def Sverify(peer_public_key, message)
include ThemisCommon
include ThemisImport
public_key_, public_key_length_= string_to_pointer_size(peer_public_key)
message_, message_length_=string_to_pointer_size(message)
unwrapped_message_length = FFI::MemoryPointer.new(:uint)
res=themis_secure_message_unwrap(nil, 0, public_key_, public_key_length_, message_, message_length_, nil, unwrapped_message_length)
raise ThemisError, "Secure Message failed verifying: #{res}" unless res == BUFFER_TOO_SMALL
unwrapped_message = FFI::MemoryPointer.new(:char, unwrapped_message_length.read_uint)
res=themis_secure_message_unwrap(nil, 0, public_key_, public_key_length_, message_, message_length_, unwrapped_message, unwrapped_message_length)
raise ThemisError, "Secure Message failed verifying: #{res}" unless res == SUCCESS
return unwrapped_message.get_bytes(0, unwrapped_message_length.read_uint);
end
|