internal Certificate(DigitalSignature digitalSignature, Stream stream) { if (digitalSignature == null) { throw new ArgumentNullException("digitalSignature"); } byte[] signature; if (digitalSignature.DigitalSignatureAlgorithm == DigitalSignatureAlgorithm.EcDsaP521_Sha256) { signature = EcDsaP521_Sha256.Sign(digitalSignature.PrivateKey, stream); } else if (digitalSignature.DigitalSignatureAlgorithm == DigitalSignatureAlgorithm.Rsa2048_Sha256) { signature = Rsa2048_Sha256.Sign(digitalSignature.PrivateKey, stream); } else { return; } this.Nickname = digitalSignature.Nickname; this.DigitalSignatureAlgorithm = digitalSignature.DigitalSignatureAlgorithm; this.PublicKey = digitalSignature.PublicKey; this.Signature = signature; }