小编Uma*_*adi的帖子

使用IDataProtector的机器密钥 - ASP.NET CORE

有没有办法可以指定单独的加密和验证密钥.目前,只有一个主密钥可以同时进行验证和加密.但是,我们在Web场中有多个应用程序,并且只有一个应用程序在ASP.NET CORE上运行,并且它在IIS上托管.应用程序的其余部分(在ASP.NET*Not core上运行)使用相同的机器密钥.当然,机器密钥具有解密和验证密钥,并且所有其他应用程序使用相同的机器密钥来同步它们之间的数据.我还想让CORE应用程序与相同的键同步.目前,核心应用程序有这个.IDataProtector使用master来验证和加密/解密.

  <?xml version="1.0" encoding="utf-8"?>
    <key id="6015093e-8571-4244-8824-17157f248d13" version="1">
      <creationDate>2017-10-03T12:13:26.6902857Z</creationDate>
      <activationDate>2017-10-03T13:13:26.6897307+01:00</activationDate>
      <expirationDate>2017-11-03T13:13:26.6898152+01:00</expirationDate>
      <descriptor>
        <descriptor>
          <encryption algorithm="AES_256_CBC" />
          <validation algorithm="HMACSHA256" />
          <masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
            <value>**This is the key**</value>
          </masterKey>
        </descriptor>
      </descriptor>
    </key>
Run Code Online (Sandbox Code Playgroud)

我想要这样的东西

    <descriptor>
      <encryption algorithm="AES_256_CBC" />
      <validation algorithm="HMACSHA256" />
      <encryptionKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
        <!-- Warning: the key below is in an unencrypted form. -->
        <value>encrypt key</value>
      </encryptionKey>
      <decryptionKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
        <!-- Warning: the key below is in an unencrypted form. -->
        <value>validation key</value>
      </decryptionKey>
    </descriptor>
  </descriptor>
Run Code Online (Sandbox Code Playgroud)

指定单独的验证和加密密钥.这样的事情可能吗?

security encryption asp.net-core

9
推荐指数
1
解决办法
920
查看次数

标签 统计

asp.net-core ×1

encryption ×1

security ×1