public bool Verify(ReadOnlySequence <byte> sequence) { if (this.AlgorithmType == OmniDigitalSignatureAlgorithmType.EcDsa_P521_Sha2_256) { return(EcDsa_P521_Sha2_256.Verify(this.PublicKey, this.Value, sequence)); } else { return(false); } }
public static OmniDigitalSignature Create(string name, OmniDigitalSignatureAlgorithmType algorithmType) { if (algorithmType == OmniDigitalSignatureAlgorithmType.EcDsa_P521_Sha2_256) { var(publicKey, privateKey) = EcDsa_P521_Sha2_256.CreateKeys(); return(new OmniDigitalSignature(name, algorithmType, publicKey, privateKey)); } else { throw new NotSupportedException(nameof(algorithmType)); } }
public static OmniCertificate Create(OmniDigitalSignature digitalSignature, ReadOnlySequence <byte> sequence) { if (digitalSignature is null) { throw new ArgumentNullException(nameof(digitalSignature)); } ReadOnlyMemory <byte> value; if (digitalSignature.AlgorithmType == OmniDigitalSignatureAlgorithmType.EcDsa_P521_Sha2_256) { value = EcDsa_P521_Sha2_256.Sign(digitalSignature.PrivateKey, sequence); } else { throw new NotSupportedException(nameof(digitalSignature.AlgorithmType)); } return(new OmniCertificate(digitalSignature.Name, digitalSignature.AlgorithmType, digitalSignature.PublicKey, value)); }