<link>http://ncryptoki.com/forum.aspx</link> <description /> <docs>http://www.rssboard.org/rss-specification</docs> <generator>mojoPortal Forum module</generator> <item> <title>Cache CryptokiCollection for performance Hi,

I am trying to improve performance of PDF Signing and searching for private key takes few seconds. I was thinking to cache this private key on first search and keep it for sliding cache.

Snippet

public CryptokiCollection findTarget(Session session, string label) {     

if (cache.Contains(label))     {         

return (CryptokiCollection)cache.Get(label);     

}     else     {         

CryptokiCollection template = new CryptokiCollection();         

template.Add(new ObjectAttribute(ObjectAttribute.CKA_LABEL, label));         

template.Add(new ObjectAttribute(ObjectAttribute.CKA_CLASS, CryptokiObject.CKO_PRIVATE_KEY));         

template.Add(new ObjectAttribute(ObjectAttribute.CKA_KEY_TYPE, Key.CKK_RSA));         

var pk = session.Objects.Find(template, 1);         

 

// Store data in the cache         

CacheItemPolicy cacheItemPolicy = new CacheItemPolicy();         

cacheItemPolicy.SlidingExpiration = TimeSpan.FromHours(4);         

cache.Add(label, pk, cacheItemPolicy);         return pk;     

}

}

Is it ok to store this CryptokiCollection  in .Net Cache ?

Please advise ?

]]>
http://ncryptoki.com/Forums/Thread.aspx?pageid=9&t=320~-1#post1130 Bhavesh http://ncryptoki.com/Forums/Thread.aspx?pageid= Wed, 01 Nov 2017 13:03:06 GMT