Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added signing with extended key for Ed25519 #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions crypto/src/math/ec/rfc8032/Ed25519.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,21 @@ public static void SignPrehash(byte[] sk, int skOff, byte[] pk, int pkOff, byte[
ImplSign(sk, skOff, pk, pkOff, ctx, phflag, m, 0, m.Length, sig, sigOff);
}

public static void SignByExtendedKey(byte[] h, byte[] ctx, byte[] m, int mOff, int mLen, byte[] sig, int sigOff)
{
byte phflag = 0x00;

byte[] s = new byte[ScalarBytes];
PruneScalar(h, 0, s);

byte[] pk = new byte[PointBytes];
ScalarMultBaseEncoded(s, pk, 0);

IDigest d = CreateDigest();

ImplSign(d, h, s, pk, 0, ctx, phflag, m, mOff, mLen, sig, sigOff);
}

public static bool Verify(byte[] sig, int sigOff, byte[] pk, int pkOff, byte[] m, int mOff, int mLen)
{
byte[] ctx = null;
Expand Down