コード例 #1
0
        private void TestGetEnvelopeEncryptionBytes()
        {
            IEnvelopeEncryption <byte[]> envelopeEncryption =
                sessionFactory.GetEnvelopeEncryptionBytes(TestPartitionId);

            Assert.NotNull(envelopeEncryption);
        }
コード例 #2
0
        public void ParameterizedTests(
            IEnvelopeEncryption <byte[]> envelopeEncryptionJson,
            Mock <IMetastore <JObject> > metastore,
            KeyState cacheIK,
            KeyState metaIK,
            KeyState cacheSK,
            KeyState metaSK,
            Partition partition)
        {
            using (Session <JObject, byte[]> sessionJsonImpl =
                       new SessionJsonImpl <byte[]>(envelopeEncryptionJson))
            {
                EncryptMetastoreInteractions encryptMetastoreInteractions =
                    new EncryptMetastoreInteractions(cacheIK, metaIK, cacheSK, metaSK);
                DecryptMetastoreInteractions decryptMetastoreInteractions =
                    new DecryptMetastoreInteractions(cacheIK, cacheSK);

                // encrypt with library object(sessionJsonImpl)
                byte[] encryptedPayload = sessionJsonImpl.Encrypt(payload);

                Assert.NotNull(encryptedPayload);
                VerifyEncryptFlow(metastore, encryptMetastoreInteractions, partition);

                metastore.Invocations.Clear();
                JObject decryptedPayload = sessionJsonImpl.Decrypt(encryptedPayload);

                VerifyDecryptFlow(metastore, decryptMetastoreInteractions, partition);
                Assert.True(JToken.DeepEquals(payload, decryptedPayload));
            }
        }
コード例 #3
0
        public void ParameterizedTests(
            IEnvelopeEncryption <byte[]> envelopeEncryptionJson,
            Mock <MemoryPersistenceImpl <JObject> > metastorePersistence,
            KeyState cacheIK,
            KeyState metaIK,
            KeyState cacheSK,
            KeyState metaSK,
            AppEncryptionPartition appEncryptionPartition)
        {
            using (AppEncryption <JObject, byte[]> appEncryptionJsonImpl =
                       new AppEncryptionJsonImpl <byte[]>(envelopeEncryptionJson))
            {
                EncryptMetastoreInteractions encryptMetastoreInteractions =
                    new EncryptMetastoreInteractions(cacheIK, metaIK, cacheSK, metaSK);
                DecryptMetastoreInteractions decryptMetastoreInteractions =
                    new DecryptMetastoreInteractions(cacheIK, cacheSK);

                // encrypt with library object(appEncryptionJsonImpl)
                byte[] encryptedPayload = appEncryptionJsonImpl.Encrypt(payload);

                Assert.NotNull(encryptedPayload);
                VerifyEncryptFlow(metastorePersistence, encryptMetastoreInteractions, appEncryptionPartition);

                metastorePersistence.Reset();
                JObject decryptedPayload = appEncryptionJsonImpl.Decrypt(encryptedPayload);

                VerifyDecryptFlow(metastorePersistence, decryptMetastoreInteractions, appEncryptionPartition);
                Assert.True(JToken.DeepEquals(payload, decryptedPayload));
            }
        }
コード例 #4
0
        public Session <byte[], byte[]> GetSessionBytes(string partitionId)
        {
            IEnvelopeEncryption <byte[]> envelopeEncryption = GetEnvelopeEncryptionBytes(partitionId);

            return(new SessionBytesImpl <byte[]>(envelopeEncryption));
        }
コード例 #5
0
        public Session <byte[], JObject> GetSessionBytesAsJson(string partitionId)
        {
            IEnvelopeEncryption <JObject> envelopeEncryption = GetEnvelopeEncryptionJson(partitionId);

            return(new SessionBytesImpl <JObject>(envelopeEncryption));
        }
コード例 #6
0
 public SessionJsonImpl(IEnvelopeEncryption <TD> envelopeEncryption)
 {
     this.envelopeEncryption = envelopeEncryption;
 }
コード例 #7
0
 public AppEncryptionBytesImpl(IEnvelopeEncryption <TD> envelopeEncryption)
 {
     this.envelopeEncryption = envelopeEncryption;
 }
コード例 #8
0
        public AppEncryption <JObject, byte[]> GetAppEncryptionJson(string partitionId)
        {
            IEnvelopeEncryption <byte[]> envelopeEncryption = GetEnvelopeEncryptionBytes(partitionId);

            return(new AppEncryptionJsonImpl <byte[]>(envelopeEncryption));
        }
コード例 #9
0
        public AppEncryption <JObject, JObject> GetAppEncryptionJsonAsJson(string partitionId)
        {
            IEnvelopeEncryption <JObject> envelopeEncryption = GetEnvelopeEncryptionJson(partitionId);

            return(new AppEncryptionJsonImpl <JObject>(envelopeEncryption));
        }
コード例 #10
0
 public EnvelopeEncryptionBytesImpl(IEnvelopeEncryption <JObject> envelopeEncryptionJson)
 {
     this.envelopeEncryptionJson = envelopeEncryptionJson;
 }