public static CryptoKey CreateRequestWithPublicKey(string publicKey, string privatekey, bool IsPrivateKeyEncrypted, string privateKeyHash = null) { var request = new CryptoKey { RequestDate = DateTime.UtcNow, ReleaseDate = DateTime.Now, KeyToken = UniqueIdGenerator.GetUniqueId(), PublicKey = publicKey, PrivateKey = privatekey, PrivateKeyHash = privateKeyHash, IsPrivateKeyEncrypted = IsPrivateKeyEncrypted, Notifications = new EntityCollection<Notification>(), Messages = new EntityCollection<Message>(), }; return request; }
public static CryptoKey CreateRequestWithPassPhrase(string passphrase) { var key = AsymmetricCryptoProvider.GenerateKeys(); var request = new CryptoKey { RequestDate = DateTime.UtcNow, ReleaseDate = DateTime.Now, KeyToken = UniqueIdGenerator.GetUniqueId(), PublicKey = key.PublicKey, PrivateKey = new SymmetricCryptoProvider().EncryptWithKey(key.PrivateKey, passphrase), PrivateKeyHash = SymmetricCryptoProvider.GetSecureHashForString(key.PrivateKey), IsPrivateKeyEncrypted = true, IsPublicKeyOnly = false, Notifications = new EntityCollection<Notification>(), Messages = new EntityCollection<Message>(), }; return request; }
public static CryptoKey CreateRequest(DateTime? releaseDate = null) { var key = AsymmetricCryptoProvider.GenerateKeys(); var request = new CryptoKey { RequestDate = DateTime.Now, ReleaseDate = releaseDate ?? DateTime.Now, KeyToken = UniqueIdGenerator.GetUniqueId(), PrivateKey = key.PrivateKey, PublicKey = key.PublicKey, IsPrivateKeyEncrypted = false, IsPublicKeyOnly = false, Notifications = new EntityCollection<Notification>(), Messages = new EntityCollection<Message>(), }; return request; }