Skip to content

Commit

Permalink
Fix NullReferenceException in COSE Key constructor that takes BouncyC…
Browse files Browse the repository at this point in the history
…astle AsymmetricKeyParameter objects

This particular constructor doesn't initialize _map, and so FromKey's attempts to call Add on it result in a NullReferenceException. Fix by calling the parameterless constructor first, which does this initialization.
  • Loading branch information
kevinmkane authored and jimsch committed May 13, 2020
1 parent 7208ff0 commit 80636be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion COSE/Key.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public OneKey(CBORObject objKey)
_map = objKey;
}

public OneKey(AsymmetricKeyParameter publicKey, AsymmetricKeyParameter privateKey)
public OneKey(AsymmetricKeyParameter publicKey, AsymmetricKeyParameter privateKey) : this()
{
if (publicKey != null) {
FromKey(publicKey);
Expand Down

0 comments on commit 80636be

Please sign in to comment.