Пример #1
0
        private static unsafe void SerializePublicKey(byte *serializedRef, byte *deserializedRef)
        {
            int bytesWritten = Platform switch
            {
                OsPlatform.Windows => Win64Lib.blsPublicKeySerialize(serializedRef, PublicKeyLength, deserializedRef),
                OsPlatform.Linux => PosixLib.blsPublicKeySerialize(serializedRef, PublicKeyLength, deserializedRef),
                OsPlatform.Mac => MacLib.blsPublicKeySerialize(serializedRef, PublicKeyLength, deserializedRef),
                _ => throw new ArgumentOutOfRangeException(Platform.ToString())
            };

            if (bytesWritten != PublicKeyLength)
            {
                throw new CryptographicException($"Bytes written was {bytesWritten} when serializing public key");
            }
        }