创建密钥以加密 JWT 令牌的 GetBytes() 和 FromBase64String() 之间有什么区别?

问题描述 投票:0回答:0

我需要加密 JWT 令牌,我看到创建对称密钥,有不同的选项。最常见的是:

new SymmetricSecurityKey(Convert.FromBase64String(myPassword));

new SymmetricSecurityKey(System.Text.Encoding.Default.GetBytes(paramClaveCifrado));

有什么不同吗?因为在这两种情况下,它都使用 SymmetricSecurityKey() 方法来生成密钥,但我不知道是否使用 GetByte() 或 FromBase64Stirng() 它可以引入一些差异。

有区别吗?

谢谢。

security encryption jwt
© www.soinside.com 2019 - 2024. All rights reserved.