Using Symmetric keys in Tink - tink

I am trying to store cleartext password in properties file and load that JSON using CleartextKeysetHandle.read
However, when I want to rotate the key, I would like to introduce another key which is another cleartext password. How can I load this key and add it to keymanager ?

Copied from https://groups.google.com/forum/#!topic/tink-users/5NHf8BOPWgM:
Yes. You can use KeysetManager [1] to rotate an existing keyset. Basically you read the keyset with CleartextKeysetHandle, and use the resulting KeysetHandle to build a KeysetManager which allows you to rotate, add or disable keys.
Cheers,
Thai.
[1] http://google.github.io/tink/javadoc/tink/1.2.2/com/google/crypto/tink/KeysetManager.html

Related

How to bust the cache or obtain cache key when using <distributed-cache> Tag helper in Asp.net Core MVC

Having an issue with the <distributed-cache> tag and Redis.
We have a <partial> Razor view that displays results of a long-running query. We acquire the data from a service injected in using #inject. The data updates very rarely, hence we wrap the content in a <distributed-cache> tag helper, with a long expires-after attribute.
However, when the data is finally updated (in another part of our app), we need to delete that key from the distributed cache, in order to force the page to update on next execution. (It's not possible for us to predict when the data will change - we can only respond to an external event.)
The problem we're having is that, despite having a fixed name attribute, the cache key appears to be impossible to predict. For example <distributed-cache name='_myQuery' vary-by-user='true'> creates a key something along the lines 7/za/Bc/ZRn/MsR/hG69TYTx1LEzqBvlyH1OLJgrpk4= in Redis.
How can I either:
Predict/calculate what the cache key is going to be in redis, so that I can delete it in another part of our application?;
Force the <distributed-cache> tag to ignore the cached value this one time? I know we have the enabled property, because this isn't going to work because the page doesn't know when to invalidate the cache.
After digging into the ASP.NET Core source I've found the CacheTagKey.cs file, which contains the GenerateKey() and GenerateHaskedKey() methods. These methods create the key from a bunch of params, then SHA256 hashes the key and returns base64.
So it looks like I can use this to predict the cache key and solve the issue.

SnmpSharpNet Add User (SNMPv3)

I'm very simply trying to add a user to the device given the security name, auth key, auth protocol, priv key, and priv protocol using VB.net. At this point, NOT using VB.net is not an option.
SNMPSharpNet does not seem to have a solution for this problem. Open to all and any alternatives. If I would know what OID's to store these values in then I would be all set, so that would be extremely helpful as well. Also open to using the PowerSNMP library.
The answer is to set usmUserStatus + index of new user equal to 4 (CREATE_AND_WAIT) and then set usmUserCloneFrom to usmSecurityName + index of user you want to clone from.

Can we do simultaneous multiple operations in Redis like a Stored Procedure

I have a User's information which I have stored in a Hash. I have his permission information stored in a Set.
I want to test for a condition on the Set, retrieve the Key and then fetch the actual Value using the retrieved Key from the Hash.
How can I do this?
Do I have to use Lua scripting to achieve the above goal or is there any other way?
You'll have to do it using multiple requests in that case. While Lua appears to be the way, your requirements - namely fetch a key based on the value of another key - rule out a single script since key names should be passed explicitly.
I had the same requirement and I couldn't find any other way to do this. Redis pipeline and transaction functions are other tools to execute multiple commands in single step but for your situation where you want to get a value and execute a command based on it, the only way remains is LUA!!
you can use a hash to handle user information and his permissions (in the same hash). In this case, when you have a userId you can retrieve the permissions with one shot by using userId and permissionKey. See example below, I put the permissions as string (in your case put it as Set):
redis> HSET userId permissionKey "perm1, perm2, perm3"
redis> HGET userId permissionKey
"perm1, perm2, perm3"
Hope this help you.

how to put key of element to disk when used bigmemory

I want to config hybrid mode to store the data on offheap and if offheap is full the data can be stored on disk,and how to put the key of element to disk?if you know,can you tell me how to put the key of the element on disk when I used the hybrid mode?

Get value setted in GM_setValue from a custom Firefox extension

Do you know if a custom Firefox extension can read values setted calling GM_setValue() from a GraseMonkey user script?
These values exists in about:config, (enter "greasemonkey" in the filter).
Perhaps there exists an easier way to get them, though...
Since Greasemonkey 1.13 GM_setValue() uses an SQLite db to persist values.
This DB can be accessed directly (see https://github.com/greasemonkey/greasemonkey/blob/master/modules/miscapis.js).

Resources