SB
echo '#{data}' | openssl smime -sign -signer #{options.crt_path} -inkey #{options.key_path} -binary -in - -outform DER -nocerts -noattr -out #{signature_path}
затем:
Base64.urlsafe_encode64(File.read(signature_path).force_encoding('utf-8'), padding: false)
но ЕСИА ругается, что мол не верная подпись