dongyao4419 2019-05-20 06:40
浏览 208

从UI将数据库密钥存储在数据库中

I'm integrating payment gateway in our application. I have an account in their website with an API key and secret key.

The users of our application are sub merchants. They will get their own account in the payment gateway website with an API key and secret key. When I asked their support, they said the main account(our account) cant access the api, secret key of the users of our application and we will have to get it from the users.

We are the ones who will be adding sub merchants and creating accounts in the payment gateway website for the users of our application. So we will have access to api key and secret key of each user.

We will have to save the api key and secret key of each user in our database. My question is should it be done from front end on a web service call. The admin login of our application will enter the api key and secret key of each user and save it to our database.

Is it safe to save the secret key from the front end or is there an other way that we can save it to our database.

  • 写回答

1条回答 默认 最新

  • douao2019 2019-05-20 07:02
    关注

    This is an interesting question and there are several ways to achieve what you want. Here's my suggestion.

    If the entire application is secured by TLS which i think will mostly be (I mean not just having HTTPS but also having TLS from your DB to the Backend) then take the input from the frontend and save it to your database but before saving it encrypt the same using any good encryption method and save the secretkey to the db. The key for this encryption (This is not the secret key but another key for encrypting and decrypting the secret key) must be an environmental variable. This will also help you guys if the db gets hacked or starts leaking.

    评论

报告相同问题?

悬赏问题

  • ¥20 蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏