public void StoreKey(string bucket, string handle, CryptoKey key) { using (var dataContext = new TransactedDatabaseEntities(System.Data.IsolationLevel.ReadCommitted)) { var sharedAssociation = new SymmetricCryptoKey { Bucket = bucket, Handle = handle, ExpirationUtc = key.ExpiresUtc, Secret = key.Key, }; dataContext.AddToSymmetricCryptoKeys(sharedAssociation); } }
/// <summary> /// Deprecated Method for adding a new object to the SymmetricCryptoKeys EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSymmetricCryptoKeys(SymmetricCryptoKey symmetricCryptoKey) { base.AddObject("SymmetricCryptoKeys", symmetricCryptoKey); }
/// <summary> /// Create a new SymmetricCryptoKey object. /// </summary> /// <param name="cryptoKeyId">Initial value of the CryptoKeyId property.</param> /// <param name="bucket">Initial value of the Bucket property.</param> /// <param name="handle">Initial value of the Handle property.</param> /// <param name="expirationUtc">Initial value of the ExpirationUtc property.</param> /// <param name="secret">Initial value of the Secret property.</param> public static SymmetricCryptoKey CreateSymmetricCryptoKey(global::System.Int32 cryptoKeyId, global::System.String bucket, global::System.String handle, global::System.DateTime expirationUtc, global::System.Byte[] secret) { SymmetricCryptoKey symmetricCryptoKey = new SymmetricCryptoKey(); symmetricCryptoKey.CryptoKeyId = cryptoKeyId; symmetricCryptoKey.Bucket = bucket; symmetricCryptoKey.Handle = handle; symmetricCryptoKey.ExpirationUtc = expirationUtc; symmetricCryptoKey.Secret = secret; return symmetricCryptoKey; }