diff options
author | Mike Mazur | 2009-02-04 00:01:36 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-04 00:01:36 +0000 |
commit | 0c03a48fb2060eda4d288e2d2ca4e650ce000b4b (patch) | |
tree | a90465075960c92367b0a5e62db3121e4e3a139d /OpenSim/Framework/Communications/Cache | |
parent | * Add another object to the existing save oar test (diff) | |
download | opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.zip opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.gz opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.bz2 opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.xz |
- add OpenSim.Framework.AssetMetadata class. AssetBase is now composed of it
- trim trailing whitespace
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
4 files changed, 68 insertions, 68 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 653597b..2b2467c 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
42 | /// <summary> | 42 | /// <summary> |
43 | /// Manages local cache of assets and their sending to viewers. | 43 | /// Manages local cache of assets and their sending to viewers. |
44 | /// </summary> | 44 | /// </summary> |
45 | /// | 45 | /// |
46 | /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either | 46 | /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either |
47 | /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and | 47 | /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and |
48 | /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and | 48 | /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and |
@@ -80,7 +80,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
80 | private Dictionary<UUID, AssetRequestsList> RequestLists; | 80 | private Dictionary<UUID, AssetRequestsList> RequestLists; |
81 | 81 | ||
82 | /// <summary> | 82 | /// <summary> |
83 | /// The 'server' from which assets can be requested and to which assets are persisted. | 83 | /// The 'server' from which assets can be requested and to which assets are persisted. |
84 | /// </summary> | 84 | /// </summary> |
85 | private readonly IAssetServer m_assetServer; | 85 | private readonly IAssetServer m_assetServer; |
86 | 86 | ||
@@ -211,7 +211,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
211 | else | 211 | else |
212 | { | 212 | { |
213 | // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); | 213 | // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); |
214 | 214 | ||
215 | NewAssetRequest req = new NewAssetRequest(callback); | 215 | NewAssetRequest req = new NewAssetRequest(callback); |
216 | AssetRequestsList requestList; | 216 | AssetRequestsList requestList; |
217 | 217 | ||
@@ -228,10 +228,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
228 | // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); | 228 | // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); |
229 | requestList = new AssetRequestsList(); | 229 | requestList = new AssetRequestsList(); |
230 | requestList.TimeRequested = DateTime.Now; | 230 | requestList.TimeRequested = DateTime.Now; |
231 | requestList.Requests.Add(req); | 231 | requestList.Requests.Add(req); |
232 | 232 | ||
233 | RequestLists.Add(assetId, requestList); | 233 | RequestLists.Add(assetId, requestList); |
234 | 234 | ||
235 | m_assetServer.RequestAsset(assetId, isTexture); | 235 | m_assetServer.RequestAsset(assetId, isTexture); |
236 | } | 236 | } |
237 | } | 237 | } |
@@ -247,7 +247,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
247 | /// the allowed number of polls. This isn't a very good way of doing things since a single thread | 247 | /// the allowed number of polls. This isn't a very good way of doing things since a single thread |
248 | /// is processing inbound packets, so if the asset server is slow, we could block this for up to | 248 | /// is processing inbound packets, so if the asset server is slow, we could block this for up to |
249 | /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset() | 249 | /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset() |
250 | /// | 250 | /// |
251 | /// <param name="assetID"></param> | 251 | /// <param name="assetID"></param> |
252 | /// <param name="isTexture"></param> | 252 | /// <param name="isTexture"></param> |
253 | /// <returns>null if the asset could not be retrieved</returns> | 253 | /// <returns>null if the asset could not be retrieved</returns> |
@@ -264,7 +264,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
264 | { | 264 | { |
265 | return asset; | 265 | return asset; |
266 | } | 266 | } |
267 | 267 | ||
268 | m_assetServer.RequestAsset(assetID, isTexture); | 268 | m_assetServer.RequestAsset(assetID, isTexture); |
269 | 269 | ||
270 | do | 270 | do |
@@ -275,7 +275,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
275 | { | 275 | { |
276 | return asset; | 276 | return asset; |
277 | } | 277 | } |
278 | } | 278 | } |
279 | while (--maxPolls > 0); | 279 | while (--maxPolls > 0); |
280 | 280 | ||
281 | m_log.WarnFormat("[ASSET CACHE]: {0} {1} was not received before the retrieval timeout was reached", | 281 | m_log.WarnFormat("[ASSET CACHE]: {0} {1} was not received before the retrieval timeout was reached", |
@@ -290,17 +290,17 @@ namespace OpenSim.Framework.Communications.Cache | |||
290 | /// <param name="asset"></param> | 290 | /// <param name="asset"></param> |
291 | public void AddAsset(AssetBase asset) | 291 | public void AddAsset(AssetBase asset) |
292 | { | 292 | { |
293 | if (!m_memcache.Contains(asset.FullID)) | 293 | if (!m_memcache.Contains(asset.Metadata.FullID)) |
294 | { | 294 | { |
295 | m_log.Info("[CACHE] Caching " + asset.FullID + " for 24 hours from last access"); | 295 | m_log.Info("[CACHE] Caching " + asset.Metadata.FullID + " for 24 hours from last access"); |
296 | // Use 24 hour rolling asset cache. | 296 | // Use 24 hour rolling asset cache. |
297 | m_memcache.AddOrUpdate(asset.FullID, asset, TimeSpan.FromHours(24)); | 297 | m_memcache.AddOrUpdate(asset.Metadata.FullID, asset, TimeSpan.FromHours(24)); |
298 | 298 | ||
299 | // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the | 299 | // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the |
300 | // information is stored locally. It could disappear, in which case we could send the | 300 | // information is stored locally. It could disappear, in which case we could send the |
301 | // ImageNotInDatabase packet to tell the client this. | 301 | // ImageNotInDatabase packet to tell the client this. |
302 | // | 302 | // |
303 | // However, this doesn't quite appear to work with local textures that are part of an avatar's | 303 | // However, this doesn't quite appear to work with local textures that are part of an avatar's |
304 | // appearance texture set. Whilst sending an ImageNotInDatabase does trigger an automatic rebake | 304 | // appearance texture set. Whilst sending an ImageNotInDatabase does trigger an automatic rebake |
305 | // and reupload by the client, if those assets aren't pushed to the asset server anyway, then | 305 | // and reupload by the client, if those assets aren't pushed to the asset server anyway, then |
306 | // on crossing onto another region server, other avatars can no longer get the required textures. | 306 | // on crossing onto another region server, other avatars can no longer get the required textures. |
@@ -314,7 +314,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
314 | // But for now, we're going to take the easy way out and store local assets globally. | 314 | // But for now, we're going to take the easy way out and store local assets globally. |
315 | // | 315 | // |
316 | // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. | 316 | // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. |
317 | if (!asset.Temporary || asset.Local) | 317 | if (!asset.Metadata.Temporary || asset.Metadata.Local) |
318 | { | 318 | { |
319 | m_assetServer.StoreAsset(asset); | 319 | m_assetServer.StoreAsset(asset); |
320 | } | 320 | } |
@@ -345,25 +345,25 @@ namespace OpenSim.Framework.Communications.Cache | |||
345 | { | 345 | { |
346 | 346 | ||
347 | AssetInfo assetInf = new AssetInfo(asset); | 347 | AssetInfo assetInf = new AssetInfo(asset); |
348 | if (!m_memcache.Contains(assetInf.FullID)) | 348 | if (!m_memcache.Contains(assetInf.Metadata.FullID)) |
349 | { | 349 | { |
350 | m_memcache.AddOrUpdate(assetInf.FullID, assetInf, TimeSpan.FromHours(24)); | 350 | m_memcache.AddOrUpdate(assetInf.Metadata.FullID, assetInf, TimeSpan.FromHours(24)); |
351 | 351 | ||
352 | if (StatsManager.SimExtraStats != null) | 352 | if (StatsManager.SimExtraStats != null) |
353 | { | 353 | { |
354 | StatsManager.SimExtraStats.AddAsset(assetInf); | 354 | StatsManager.SimExtraStats.AddAsset(assetInf); |
355 | } | 355 | } |
356 | 356 | ||
357 | if (RequestedAssets.ContainsKey(assetInf.FullID)) | 357 | if (RequestedAssets.ContainsKey(assetInf.Metadata.FullID)) |
358 | { | 358 | { |
359 | AssetRequest req = RequestedAssets[assetInf.FullID]; | 359 | AssetRequest req = RequestedAssets[assetInf.Metadata.FullID]; |
360 | req.AssetInf = assetInf; | 360 | req.AssetInf = assetInf; |
361 | req.NumPackets = CalculateNumPackets(assetInf.Data); | 361 | req.NumPackets = CalculateNumPackets(assetInf.Data); |
362 | 362 | ||
363 | RequestedAssets.Remove(assetInf.FullID); | 363 | RequestedAssets.Remove(assetInf.Metadata.FullID); |
364 | // If it's a direct request for a script, drop it | 364 | // If it's a direct request for a script, drop it |
365 | // because it's a hacked client | 365 | // because it's a hacked client |
366 | if (req.AssetRequestSource != 2 || assetInf.Type != 10) | 366 | if (req.AssetRequestSource != 2 || assetInf.Metadata.Type != 10) |
367 | AssetRequests.Add(req); | 367 | AssetRequests.Add(req); |
368 | } | 368 | } |
369 | } | 369 | } |
@@ -373,8 +373,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
373 | 373 | ||
374 | lock (RequestLists) | 374 | lock (RequestLists) |
375 | { | 375 | { |
376 | if (RequestLists.TryGetValue(asset.FullID, out reqList)) | 376 | if (RequestLists.TryGetValue(asset.Metadata.FullID, out reqList)) |
377 | RequestLists.Remove(asset.FullID); | 377 | RequestLists.Remove(asset.Metadata.FullID); |
378 | } | 378 | } |
379 | 379 | ||
380 | if (reqList != null) | 380 | if (reqList != null) |
@@ -385,8 +385,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
385 | foreach (NewAssetRequest req in reqList.Requests) | 385 | foreach (NewAssetRequest req in reqList.Requests) |
386 | { | 386 | { |
387 | // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked | 387 | // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked |
388 | // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.FullID); | 388 | // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.Metadata.FullID); |
389 | req.Callback(asset.FullID, asset); | 389 | req.Callback(asset.Metadata.FullID, asset); |
390 | } | 390 | } |
391 | } | 391 | } |
392 | } | 392 | } |
@@ -398,12 +398,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
398 | 398 | ||
399 | // Remember the fact that this asset could not be found to prevent delays from repeated requests | 399 | // Remember the fact that this asset could not be found to prevent delays from repeated requests |
400 | m_memcache.Add(assetID, null, TimeSpan.FromHours(24)); | 400 | m_memcache.Add(assetID, null, TimeSpan.FromHours(24)); |
401 | 401 | ||
402 | // Notify requesters for this asset | 402 | // Notify requesters for this asset |
403 | AssetRequestsList reqList; | 403 | AssetRequestsList reqList; |
404 | lock (RequestLists) | 404 | lock (RequestLists) |
405 | { | 405 | { |
406 | if (RequestLists.TryGetValue(assetID, out reqList)) | 406 | if (RequestLists.TryGetValue(assetID, out reqList)) |
407 | RequestLists.Remove(assetID); | 407 | RequestLists.Remove(assetID); |
408 | } | 408 | } |
409 | 409 | ||
@@ -411,7 +411,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
411 | { | 411 | { |
412 | if (StatsManager.SimExtraStats != null) | 412 | if (StatsManager.SimExtraStats != null) |
413 | StatsManager.SimExtraStats.AddAssetRequestTimeAfterCacheMiss(DateTime.Now - reqList.TimeRequested); | 413 | StatsManager.SimExtraStats.AddAssetRequestTimeAfterCacheMiss(DateTime.Now - reqList.TimeRequested); |
414 | 414 | ||
415 | foreach (NewAssetRequest req in reqList.Requests) | 415 | foreach (NewAssetRequest req in reqList.Requests) |
416 | { | 416 | { |
417 | req.Callback(assetID, null); | 417 | req.Callback(assetID, null); |
@@ -461,7 +461,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
461 | source = 3; | 461 | source = 3; |
462 | //Console.WriteLine("asset request " + requestID); | 462 | //Console.WriteLine("asset request " + requestID); |
463 | } | 463 | } |
464 | 464 | ||
465 | //check to see if asset is in local cache, if not we need to request it from asset server. | 465 | //check to see if asset is in local cache, if not we need to request it from asset server. |
466 | //Console.WriteLine("asset request " + requestID); | 466 | //Console.WriteLine("asset request " + requestID); |
467 | if (!m_memcache.Contains(requestID)) | 467 | if (!m_memcache.Contains(requestID)) |
@@ -494,7 +494,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
494 | } | 494 | } |
495 | 495 | ||
496 | // Scripts cannot be retrieved by direct request | 496 | // Scripts cannot be retrieved by direct request |
497 | if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10) | 497 | if (transferRequest.TransferInfo.SourceType == 2 && asset.Metadata.Type == 10) |
498 | return; | 498 | return; |
499 | 499 | ||
500 | // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list | 500 | // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list |
@@ -520,7 +520,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
520 | //no requests waiting | 520 | //no requests waiting |
521 | return; | 521 | return; |
522 | } | 522 | } |
523 | 523 | ||
524 | // if less than 5, do all of them | 524 | // if less than 5, do all of them |
525 | int num = Math.Min(5, AssetRequests.Count); | 525 | int num = Math.Min(5, AssetRequests.Count); |
526 | 526 | ||
@@ -580,10 +580,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
580 | public AssetInfo(AssetBase aBase) | 580 | public AssetInfo(AssetBase aBase) |
581 | { | 581 | { |
582 | Data = aBase.Data; | 582 | Data = aBase.Data; |
583 | FullID = aBase.FullID; | 583 | Metadata.FullID = aBase.Metadata.FullID; |
584 | Type = aBase.Type; | 584 | Metadata.Type = aBase.Metadata.Type; |
585 | Name = aBase.Name; | 585 | Metadata.Name = aBase.Metadata.Name; |
586 | Description = aBase.Description; | 586 | Metadata.Description = aBase.Metadata.Description; |
587 | } | 587 | } |
588 | } | 588 | } |
589 | 589 | ||
@@ -592,10 +592,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
592 | public TextureImage(AssetBase aBase) | 592 | public TextureImage(AssetBase aBase) |
593 | { | 593 | { |
594 | Data = aBase.Data; | 594 | Data = aBase.Data; |
595 | FullID = aBase.FullID; | 595 | Metadata.FullID = aBase.Metadata.FullID; |
596 | Type = aBase.Type; | 596 | Metadata.Type = aBase.Metadata.Type; |
597 | Name = aBase.Name; | 597 | Metadata.Name = aBase.Metadata.Name; |
598 | Description = aBase.Description; | 598 | Metadata.Description = aBase.Metadata.Description; |
599 | } | 599 | } |
600 | } | 600 | } |
601 | 601 | ||
@@ -608,7 +608,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
608 | /// A list of requests for assets | 608 | /// A list of requests for assets |
609 | /// </summary> | 609 | /// </summary> |
610 | public List<NewAssetRequest> Requests = new List<NewAssetRequest>(); | 610 | public List<NewAssetRequest> Requests = new List<NewAssetRequest>(); |
611 | 611 | ||
612 | /// <summary> | 612 | /// <summary> |
613 | /// Record the time that this request was first made. | 613 | /// Record the time that this request was first made. |
614 | /// </summary> | 614 | /// </summary> |
diff --git a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs index 3ed9172..1b3e70d 100644 --- a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs | |||
@@ -86,11 +86,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
86 | 86 | ||
87 | #region Rjindael | 87 | #region Rjindael |
88 | /// <summary> | 88 | /// <summary> |
89 | /// This class uses a symmetric key algorithm (Rijndael/AES) to encrypt and | 89 | /// This class uses a symmetric key algorithm (Rijndael/AES) to encrypt and |
90 | /// decrypt data. As long as encryption and decryption routines use the same | 90 | /// decrypt data. As long as encryption and decryption routines use the same |
91 | /// parameters to generate the keys, the keys are guaranteed to be the same. | 91 | /// parameters to generate the keys, the keys are guaranteed to be the same. |
92 | /// The class uses static functions with duplicate code to make it easier to | 92 | /// The class uses static functions with duplicate code to make it easier to |
93 | /// demonstrate encryption and decryption logic. In a real-life application, | 93 | /// demonstrate encryption and decryption logic. In a real-life application, |
94 | /// this may not be the most efficient way of handling encryption, so - as | 94 | /// this may not be the most efficient way of handling encryption, so - as |
95 | /// soon as you feel comfortable with it - you may want to redesign this class. | 95 | /// soon as you feel comfortable with it - you may want to redesign this class. |
96 | /// </summary> | 96 | /// </summary> |
@@ -123,11 +123,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
123 | /// </param> | 123 | /// </param> |
124 | /// <param name="initVector"> | 124 | /// <param name="initVector"> |
125 | /// Initialization vector (or IV). This value is required to encrypt the | 125 | /// Initialization vector (or IV). This value is required to encrypt the |
126 | /// first block of plaintext data. For RijndaelManaged class IV must be | 126 | /// first block of plaintext data. For RijndaelManaged class IV must be |
127 | /// exactly 16 ASCII characters long. | 127 | /// exactly 16 ASCII characters long. |
128 | /// </param> | 128 | /// </param> |
129 | /// <param name="keySize"> | 129 | /// <param name="keySize"> |
130 | /// Size of encryption key in bits. Allowed values are: 128, 192, and 256. | 130 | /// Size of encryption key in bits. Allowed values are: 128, 192, and 256. |
131 | /// Longer keys are more secure than shorter keys. | 131 | /// Longer keys are more secure than shorter keys. |
132 | /// </param> | 132 | /// </param> |
133 | /// <returns> | 133 | /// <returns> |
@@ -143,7 +143,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
143 | { | 143 | { |
144 | // Convert strings into byte arrays. | 144 | // Convert strings into byte arrays. |
145 | // Let us assume that strings only contain ASCII codes. | 145 | // Let us assume that strings only contain ASCII codes. |
146 | // If strings include Unicode characters, use Unicode, UTF7, or UTF8 | 146 | // If strings include Unicode characters, use Unicode, UTF7, or UTF8 |
147 | // encoding. | 147 | // encoding. |
148 | byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); | 148 | byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); |
149 | byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); | 149 | byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); |
@@ -153,8 +153,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
153 | byte[] plainTextBytes = plainText; | 153 | byte[] plainTextBytes = plainText; |
154 | 154 | ||
155 | // First, we must create a password, from which the key will be derived. | 155 | // First, we must create a password, from which the key will be derived. |
156 | // This password will be generated from the specified passphrase and | 156 | // This password will be generated from the specified passphrase and |
157 | // salt value. The password will be created using the specified hash | 157 | // salt value. The password will be created using the specified hash |
158 | // algorithm. Password creation can be done in several iterations. | 158 | // algorithm. Password creation can be done in several iterations. |
159 | PasswordDeriveBytes password = new PasswordDeriveBytes( | 159 | PasswordDeriveBytes password = new PasswordDeriveBytes( |
160 | passPhrase, | 160 | passPhrase, |
@@ -173,8 +173,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
173 | // (CBC). Use default options for other symmetric key parameters. | 173 | // (CBC). Use default options for other symmetric key parameters. |
174 | symmetricKey.Mode = CipherMode.CBC; | 174 | symmetricKey.Mode = CipherMode.CBC; |
175 | 175 | ||
176 | // Generate encryptor from the existing key bytes and initialization | 176 | // Generate encryptor from the existing key bytes and initialization |
177 | // vector. Key size will be defined based on the number of the key | 177 | // vector. Key size will be defined based on the number of the key |
178 | // bytes. | 178 | // bytes. |
179 | ICryptoTransform encryptor = symmetricKey.CreateEncryptor( | 179 | ICryptoTransform encryptor = symmetricKey.CreateEncryptor( |
180 | keyBytes, | 180 | keyBytes, |
@@ -265,8 +265,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
265 | // Convert our ciphertext into a byte array. | 265 | // Convert our ciphertext into a byte array. |
266 | byte[] cipherTextBytes = cipherText; | 266 | byte[] cipherTextBytes = cipherText; |
267 | 267 | ||
268 | // First, we must create a password, from which the key will be | 268 | // First, we must create a password, from which the key will be |
269 | // derived. This password will be generated from the specified | 269 | // derived. This password will be generated from the specified |
270 | // passphrase and salt value. The password will be created using | 270 | // passphrase and salt value. The password will be created using |
271 | // the specified hash algorithm. Password creation can be done in | 271 | // the specified hash algorithm. Password creation can be done in |
272 | // several iterations. | 272 | // several iterations. |
@@ -286,8 +286,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
286 | // (CBC). Use default options for other symmetric key parameters. | 286 | // (CBC). Use default options for other symmetric key parameters. |
287 | symmetricKey.Mode = CipherMode.CBC; | 287 | symmetricKey.Mode = CipherMode.CBC; |
288 | 288 | ||
289 | // Generate decryptor from the existing key bytes and initialization | 289 | // Generate decryptor from the existing key bytes and initialization |
290 | // vector. Key size will be defined based on the number of the key | 290 | // vector. Key size will be defined based on the number of the key |
291 | // bytes. | 291 | // bytes. |
292 | ICryptoTransform decryptor = symmetricKey.CreateDecryptor( | 292 | ICryptoTransform decryptor = symmetricKey.CreateDecryptor( |
293 | keyBytes, | 293 | keyBytes, |
@@ -320,7 +320,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
320 | for (i = 0; i < decryptedByteCount; i++) | 320 | for (i = 0; i < decryptedByteCount; i++) |
321 | plainText[i] = plainTextBytes[i]; | 321 | plainText[i] = plainTextBytes[i]; |
322 | 322 | ||
323 | // Return decrypted string. | 323 | // Return decrypted string. |
324 | return plainText; | 324 | return plainText; |
325 | } | 325 | } |
326 | } | 326 | } |
@@ -403,17 +403,17 @@ namespace OpenSim.Framework.Communications.Cache | |||
403 | string salt = Convert.ToBase64String(rand); | 403 | string salt = Convert.ToBase64String(rand); |
404 | 404 | ||
405 | x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); | 405 | x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); |
406 | x.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", | 406 | x.Metadata.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", |
407 | "OPENSIM_AES_AF1", | 407 | "OPENSIM_AES_AF1", |
408 | file.AlsoKnownAs, | 408 | file.AlsoKnownAs, |
409 | salt, | 409 | salt, |
410 | x.Description); | 410 | x.Metadata.Description); |
411 | } | 411 | } |
412 | 412 | ||
413 | private bool DecryptAssetBase(AssetBase x) | 413 | private bool DecryptAssetBase(AssetBase x) |
414 | { | 414 | { |
415 | // Check it's encrypted first. | 415 | // Check it's encrypted first. |
416 | if (!x.Description.Contains("ENCASS")) | 416 | if (!x.Metadata.Description.Contains("ENCASS")) |
417 | return true; | 417 | return true; |
418 | 418 | ||
419 | // ENCASS:ALG:AKA:SALT:Description | 419 | // ENCASS:ALG:AKA:SALT:Description |
@@ -421,7 +421,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
421 | string[] splitchars = new string[1]; | 421 | string[] splitchars = new string[1]; |
422 | splitchars[0] = "#:~:#"; | 422 | splitchars[0] = "#:~:#"; |
423 | 423 | ||
424 | string[] meta = x.Description.Split(splitchars, StringSplitOptions.None); | 424 | string[] meta = x.Metadata.Description.Split(splitchars, StringSplitOptions.None); |
425 | if (meta.Length < 5) | 425 | if (meta.Length < 5) |
426 | { | 426 | { |
427 | m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); | 427 | m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); |
@@ -432,7 +432,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
432 | if (m_keyfiles.ContainsKey(meta[2])) | 432 | if (m_keyfiles.ContainsKey(meta[2])) |
433 | { | 433 | { |
434 | RjinKeyfile deckey = m_keyfiles[meta[2]]; | 434 | RjinKeyfile deckey = m_keyfiles[meta[2]]; |
435 | x.Description = meta[4]; | 435 | x.Metadata.Description = meta[4]; |
436 | switch (meta[1]) | 436 | switch (meta[1]) |
437 | { | 437 | { |
438 | case "OPENSIM_AES_AF1": | 438 | case "OPENSIM_AES_AF1": |
@@ -506,7 +506,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
506 | { | 506 | { |
507 | string assetUrl = _assetServerUrl + "/assets/"; | 507 | string assetUrl = _assetServerUrl + "/assets/"; |
508 | 508 | ||
509 | m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); | 509 | m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); |
510 | 510 | ||
511 | RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); | 511 | RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); |
512 | } | 512 | } |
diff --git a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs index 5f15c3e..8b8172e 100644 --- a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
45 | } | 45 | } |
46 | public override void StoreAsset(AssetBase asset) | 46 | public override void StoreAsset(AssetBase asset) |
47 | { | 47 | { |
48 | byte[] idBytes = asset.FullID.Guid.ToByteArray(); | 48 | byte[] idBytes = asset.Metadata.FullID.Guid.ToByteArray(); |
49 | 49 | ||
50 | string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] | 50 | string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] |
51 | + Path.DirectorySeparatorChar + idBytes[1]; | 51 | + Path.DirectorySeparatorChar + idBytes[1]; |
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
56 | if (!Directory.Exists(cdir)) | 56 | if (!Directory.Exists(cdir)) |
57 | Directory.CreateDirectory(cdir); | 57 | Directory.CreateDirectory(cdir); |
58 | 58 | ||
59 | FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create); | 59 | FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.Metadata.FullID + ".xml", FileMode.Create); |
60 | m_xs.Serialize(x, asset); | 60 | m_xs.Serialize(x, asset); |
61 | 61 | ||
62 | x.Flush(); | 62 | x.Flush(); |
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index e27c4f4..1cc9833 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs | |||
@@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
97 | // rc.Request(s); | 97 | // rc.Request(s); |
98 | //m_log.InfoFormat("[ASSET]: Stored {0}", rc); | 98 | //m_log.InfoFormat("[ASSET]: Stored {0}", rc); |
99 | 99 | ||
100 | m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); | 100 | m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); |
101 | 101 | ||
102 | RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); | 102 | RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); |
103 | } | 103 | } |