public CertificateOutputViewModel(byte[] signature, byte[] data, byte[] key, HashAlgorithmName hash, SymmetricAlgorithmName sym, SymmetricAlgorithmKey symKey, AsymmetricAlgorithmName alg, AsymmetricAlgorithmKey algKey, string file) { this.Description = "Certificate"; this.EnvelopeData = Convert.ToBase64String(data); this.EnvelopeCryptKey = key.ConvertToHex(); this.Signature = signature.ConvertToHex(); this.Methods = new List <string>() { hash.ToString(), sym.ToString(), alg.ToString() }; this.Method = string.Join("\n", Methods); this.KeyLengths = new List <string>() { "", ((int)symKey).ToString("X"), // hex ((int)algKey).ToString("X") // hex }; this.KeyLength = string.Join("\n", KeyLengths); this.FileName = file; }
private static IAsymmetricCryptoAlgorithm GetAsymmetricAlgorithm(this AsymmetricAlgorithmName name, AsymmetricAlgorithmKey keySize) { switch (name) { case AsymmetricAlgorithmName.ElGamal: return(new ElGamal(keySize: (int)keySize)); break; case AsymmetricAlgorithmName.RSA: default: return(new RSA(keySize: (int)keySize)); break; } }
public SignatureOutputViewModel(byte[] signature, HashAlgorithmName hash, AsymmetricAlgorithmName alg, AsymmetricAlgorithmKey algKey, string file) { this.Description = "Signature"; this.Signature = signature.ConvertToHex(); this.Methods = new List <string>() { hash.ToString(), alg.ToString() }; this.Method = string.Join("\n", Methods); this.KeyLengths = new List <string>() { "0A", ((int)algKey).ToString("X") // hex }; this.KeyLength = string.Join("\n", KeyLengths); this.FileName = file; }