0

we have a mobile APP and want to embed a PC page,for example: www.XXX.com

But we need member has logined in this page.

So we can build this urlwww.XXX.com?token=XXXXXXX

So the token can't be plaintext and must be encrypted,so I use a aes gem

I encrypt one member id to oDk6N21+t26f1PbvwIHtNw==$ZO319ZlmjsOMTzh+sF/hHg==

So the url turns to be www.XXX.com?token=oDk6N21+t26f1PbvwIHtNw==$ZO319ZlmjsOMTzh+sF/hHg==

Now the question is come.

I try to get the token value ,but I get oDk6N21 t26f1PbvwIHtNw==$ZO319ZlmjsOMTzh sF/hHg==

Some character has been replaced,so how can I get the original token?

HXH
  • 1,643
  • 4
  • 19
  • 31

1 Answers1

-1

It seems to be straightforward:

# generate random key
key = AES.key

# encrypting your message
encr = AES.encrypt "my message", key

# decrypt later with the same key
AES.decrypt encr, key # => "my message"

The full documentation is here.

dimakura
  • 7,575
  • 17
  • 36