Hi
I am new to both ruby and rho mobile and currently i am trying to encrypt a key using HMAC-SHA2.
But when i try to use hmac = HMAC::SHA256.new(key) i get the error as given below in the log
RhoRuby| require_compiled: error: can not find digest/sha2.so
APP| App error: library not found for class Digest::SHA256 -- digest/sha2.so
Here is my Complete Code.
Controller.rb
require 'digest'
require 'digest/sha2'
require 'hmac-sha2'
def test_hmac
key = '12344444'
signature = 'abcdef'
Alert.show_popup(key)
puts "key : #{key}"
hmac = HMAC::SHA256.new(key)
hmac.update(signature)
puts "hmac: : #{hmac}"
puts Rho::RhoSupport.url_encode(Base64.encode64("#{hmac.digest}\n"))
end
My Build.yml :
android:
manifest_template: "AndroidManifest.erb"
#android_title: 0
version: "2.3.1"
extensions:
- screenorientation
- coreapi
- hmac
- digest
- digest-sha2
capabilities:
- hardware_acceleration
capabilities:
- gps
- camera
- network_state
- Network
- hardware_acceleration
The above seems to work fine on Rho Simulator but does not work on android device.What can be the problem ??
My current version of Rhodes is 4.1.1 and of Ruby is 1.9.1
Please note that i need to make it work for both android and iOS devices
Any help is appreciated
Thanks
Siddhant
3 Replies
Hello,
Here is the doc:
Rhomobile | Ruby Native Extensions
OpenSSL – based libraries
openssl, ezcrypto
Add to build.yml:
extensions: ["openssl.so", "openssl", "digest-sha2", "ezcrypto"] digest-sha2
Add to build.yml:
extensions: ["openssl.so", "openssl", "digest", "digest-sha2" ]
openssl.so is native c-library and should be included in extensions list to use openssl-base libraries
Try it please
Regards,
Evgeny.
Evgeny, do we have a working sample? Thank you
HM
Guys any help is appreciated
thanks
Siddhant