예제 #1
0
        private static byte[] ReencryptToUser(User user, byte[] value)
        {
            if (user.DelegationToken != null)   // can be null if user is DO, then just return the original ciphertext
            {
                IPreService preProxy = CreatePreProxy();
                return(preProxy.Reencrypt(user.DelegationToken.ToUser, value));
            }

            return(value);
        }
예제 #2
0
파일: Gateway.cs 프로젝트: iqman/MACMSC
        private DataEntity ReencryptDataEntityMetadata(DataEntity dataEntity, Guid userId)
        {
            byte[] delegationKey = GetDelegationKey(userId);

            DataEntity  reencryptedEntity = new DataEntity();
            IPreService proxy             = CreatePreProxy();

            byte[] reencryptedIV = proxy.Reencrypt(delegationKey, dataEntity.AesInfo.IV);

            proxy = CreatePreProxy();
            byte[] reencryptedKey = proxy.Reencrypt(delegationKey, dataEntity.AesInfo.Key);

            reencryptedEntity.AesInfo    = new AesEncryptionInfo(reencryptedKey, reencryptedIV);
            reencryptedEntity.Attributes = dataEntity.Attributes;
            reencryptedEntity.Payload    = dataEntity.Payload;
            reencryptedEntity.Id         = dataEntity.Id;

            return(reencryptedEntity);
        }
예제 #3
0
 public byte[] Reencrypt(byte[] delegationKey, byte[] cipherText)
 {
     try
     {
         IPreService proxy = CreateProxy();
         return(proxy.Reencrypt(delegationKey, cipherText));
     }
     catch (Exception e)
     {
         Logger.LogError("Error reencrypting", e);
         throw;
     }
 }