Skip to content

Commit

Permalink
fix null
Browse files Browse the repository at this point in the history
nnhy committed Sep 23, 2023
1 parent eace37b commit 7186b5e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions NewLife.Core/Security/RSAHelper.cs
Original file line number Diff line number Diff line change
@@ -52,15 +52,15 @@ public static String WriteParameters(RSAParameters p)
{
// 判断参数p的每一个成员是否为空,如果为空则抛出异常
if (p.Modulus == null || p.Exponent == null) throw new ArgumentNullException(nameof(p));
if (p.D == null || p.P == null || p.Q == null ||
p.DP == null || p.DQ == null || p.InverseQ == null) throw new ArgumentNullException(nameof(p));

var ms = new MemoryStream();
ms.WriteArray(p.Modulus);
ms.WriteArray(p.Exponent);

if (p.D != null && p.D.Length > 0)
{
if (p.D == null || p.P == null || p.Q == null ||
p.DP == null || p.DQ == null || p.InverseQ == null) throw new ArgumentNullException(nameof(p));

ms.WriteArray(p.D);
ms.WriteArray(p.P);
ms.WriteArray(p.Q);

0 comments on commit 7186b5e

Please sign in to comment.