admin管理员组文章数量:1418719
I'm using PasswordDeriveBytes in legacy code and can't use Rfc2898DeriveBytes just yet.
When I'm getting 24 and then 8 bytes, everything works perfectly. But when I'm getting first 8 and then 24, it crashes with an ArgumentException. Very strange, because with a 32/16 combination it works in both orders.
var deriver1 = new PasswordDeriveBytes("mykey-123456789", []);
var key1 = deriver1.GetBytes(24);
var iv1 = deriver1.GetBytes(8);
var deriver2 = new PasswordDeriveBytes("mykey-123456789", []);
var iv2 = deriver2.GetBytes(8);
var key2 = deriver2.GetBytes(24); // BOOM: ArgumentException: Offset and length were out of bounds...
I would not expect ArgumentException... or is this a bug of this deprecated class? Does anyone have an explanation to this or to whether I am doing something wrong?
本文标签: cPasswordDeriveBytes 8 and 24 raises ArgumentException in some ordersStack Overflow
版权声明:本文标题:c# - PasswordDeriveBytes 8 and 24 raises ArgumentException in some orders - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745158401a2645314.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论