internal byte[] GenerateSignature(Ed25519PrivateKeyParameters privateKey, Ed25519PublicKeyParameters publicKey) { #if PORTABLE byte[] buf = ToArray(); int count = buf.Length; #else byte[] buf = GetBuffer(); int count = (int)Position; #endif byte[] signature = new byte[Ed25519PrivateKeyParameters.SignatureSize]; privateKey.Sign(Ed25519.Algorithm.Ed25519, publicKey, null, buf, 0, count, signature, 0); Reset(); return(signature); }
public virtual byte[] GenerateSignature() { if (!forSigning || null == privateKey) { throw new InvalidOperationException("Ed25519phSigner not initialised for signature generation."); } byte[] msg = new byte[Ed25519.PrehashSize]; if (Ed25519.PrehashSize != prehash.DoFinal(msg, 0)) { throw new InvalidOperationException("Prehash digest failed"); } byte[] signature = new byte[Ed25519PrivateKeyParameters.SignatureSize]; privateKey.Sign(Ed25519.Algorithm.Ed25519ph, publicKey, context, msg, 0, Ed25519.PrehashSize, signature, 0); return(signature); }
internal byte[] GenerateSignature(Ed25519PrivateKeyParameters privateKey, byte[] ctx) { lock (this) { #if PORTABLE || NETFX_CORE byte[] buf = ToArray(); int count = buf.Length; #else byte[] buf = GetBuffer(); int count = (int)Position; #endif byte[] signature = new byte[Ed25519PrivateKeyParameters.SignatureSize]; privateKey.Sign(Ed25519.Algorithm.Ed25519ctx, ctx, buf, 0, count, signature, 0); Reset(); return(signature); } }
public byte[] GenerateSignature() { if (privateKey == null) { throw new InvalidOperationException("Ed25519DigestSigner not initialised for signature generation."); } var hash = new byte[digest.GetDigestSize()]; digest.DoFinal(hash, 0); var signature = new byte[Ed25519PrivateKeyParameters.SignatureSize]; privateKey.Sign(Ed25519.Algorithm.Ed25519, null, hash, 0, hash.Length, signature, 0); Reset(); return(signature); }
public byte[] GenerateSignature() { if (privateKey == null) { throw new InvalidOperationException("Ed25519DigestSigner not initialised for signature generation."); } var hashLength = digest.GetDigestSize(); var hash = ArrayPool <byte> .Shared.Rent(hashLength); try { digest.DoFinal(hash, 0); var signature = new byte[Ed25519PrivateKeyParameters.SignatureSize]; privateKey.Sign(Ed25519.Algorithm.Ed25519, publicKey, null, hash, 0, hashLength, signature, 0); Reset(); return(signature); } finally { ArrayPool <byte> .Shared.Return(hash); } }