Exemplo n.º 1
0
 public static void Sign(ArraySegment <byte> signature, ArraySegment <byte> message, ArraySegment <byte> expandedPrivateKey)
 {
     if (signature.Array == null)
     {
         throw new ArgumentNullException("signature.Array");
     }
     if (signature.Count != SignatureSizeInBytes)
     {
         throw new ArgumentException("signature.Count");
     }
     if (expandedPrivateKey.Array == null)
     {
         throw new ArgumentNullException("expandedPrivateKey.Array");
     }
     if (expandedPrivateKey.Count != ExpandedPrivateKeySizeInBytes)
     {
         throw new ArgumentException("expandedPrivateKey.Count");
     }
     if (message.Array == null)
     {
         throw new ArgumentNullException("message.Array");
     }
     Ed25519Operations.crypto_sign2(signature.Array, signature.Offset, message.Array, message.Offset, message.Count,
                                    expandedPrivateKey.Array, expandedPrivateKey.Offset);
 }
Exemplo n.º 2
0
 public static void Sign(Span <byte> signature, ReadOnlySpan <byte> message, ReadOnlySpan <byte> expandedPrivateKey)
 {
     if (signature.Length != SignatureSizeInBytes)
     {
         throw new ArgumentException($"Signature size must be {SignatureSizeInBytes}", nameof(signature));
     }
     if (expandedPrivateKey.Length != ExpandedPrivateKeySizeInBytes)
     {
         throw new ArgumentException($"Private key size must be {ExpandedPrivateKeySizeInBytes}", nameof(expandedPrivateKey));
     }
     Ed25519Operations.crypto_sign2(signature, message, expandedPrivateKey);
 }