Return a secure key generated from the user and the object. As we load elements fron any class from user imput, this prevent the user to specify arbitrary class
12436
def create_secret(*args, **kwargs):
    """"""

    to_sign = '-!'.join(args) + '$$'.join(kwargs.values())

    key = settings.SECRET_FOR_SIGNS

    hashed = hmac.new(key, to_sign, sha1)
    return re.sub(r'[\W_]+', '', binascii.b2a_base64(hashed.digest()))
925780
private Class<?> getKey(Class<?> key)
	{
		Class<?> newKey = lookupMap.get(key);
		if (newKey != null)
			return newKey;

		for (Class<?> c : internalMap.keySet())
		{
			if (c.isAssignableFrom(key))
			{
				lookupMap.put(key, c);
				return c;
			}
		}
		return null;
	}
329507
public SecurityHandler getObject() throws Exception {
        ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
        securityHandler.setAuthenticator(authenticator);
        securityHandler.setRealmName(realm);

        for (Entry<String, Constraint> constraint : constraints.entrySet()) {
            ConstraintMapping constraintMapping = new ConstraintMapping();
            constraintMapping.setConstraint(constraint.getValue());
            constraintMapping.setPathSpec(constraint.getKey());

            securityHandler.addConstraintMapping(constraintMapping);
        }

        securityHandler.setLoginService(loginService);

        return securityHandler;
    }
781849
private final static String key(Class from, Class to) {
        return from.getName() + "->" + to.getName();
    }
1290201
@SuppressWarnings("unchecked")
	public T initKeys() {
		KeyPair keyPair = SecureUtil.generateKeyPair(this.algorithm);
		this.publicKey = keyPair.getPublic();
		this.privateKey = keyPair.getPrivate();
		return (T) this;
	}
497156
def safe_get(d, key, def_val=None):
    
    if d.has_key(key):
        return d[key]
    else:
        return def_val
412182
public PBKey getPBKey()
    {
        if (pbKey == null)
        {
            this.pbKey = new PBKey(this.getJcdAlias(), this.getUserName(), this.getPassWord());
        }
        return pbKey;
    }
951480
private static Object getLockObject(Object key) {
    int hc = key.hashCode();
    return KEY_LOCKS[hc & KEY_LOCKS_MASK];
  }
265467
def get_object_key(self, key, using_name=True):
        
        try:
            if using_name:
                return self.o_name[key].key
            else:
                return self.o[key].key
        except KeyError:
            raise ValueError("'%s' are not found!" % key)
419585
def _gen_key(self, key):
        
        b_key = self._md5_digest(key)
        return self._hashi(b_key, lambda x: x)
1098036
def get(user)
      mechanism = user.mechanism
      raise InvalidMechanism.new(mechanism) if !SOURCES.has_key?(mechanism)
      SOURCES[mechanism].new(user)
    end
882722
private static @Nullable SecretKey loadSymmetricKey(Context context, KeyPair wrapperKey) throws NoSuchPaddingException,
	                                                                                                NoSuchAlgorithmException,
	                                                                                                InvalidKeyException {
		String encryptedSymmetricKey = getKeyPrefs(context).getString(PREFS_KEY_SYMMETRIC_KEY, null);
		if (StringUtils.isNullOrEmpty(encryptedSymmetricKey)) {
			return null;
		}

		return unwrapSymmetricKey(wrapperKey, encryptedSymmetricKey);
	}
728313
function () {
        var obj = PropertyBase.toJSON(this);

        _.unset(obj, 'key.value');
        _.unset(obj, 'cert.value');
        _.unset(obj, 'pfx.value');

        return obj;
    }
99600
def get(key, default=-1):
        """"""
        if isinstance(key, int):
            return Cipher(key)
        if key not in Cipher._member_map_:
            extend_enum(Cipher, key, default)
        return Cipher[key]
1040537
def get_key(cls, k, default=None):
        
        k = cls.__name__ + "__" + k
        if k in session:
            return session[k]
        else:
            return default
688329
public synchronized String get() {
        ConfidentialStore cs = ConfidentialStore.get();
        if (secret == null || cs != lastCS) {
            lastCS = cs;
            try {
                byte[] payload = load();
                if (payload == null) {
                    payload = cs.randomBytes(length / 2);
                    store(payload);
                }
                secret = Util.toHexString(payload).substring(0, length);
            } catch (IOException e) {
                throw new Error("Failed to load the key: " + getId(), e);
            }
        }
        return secret;
    }
1295280
def get_session_key(
        user,
        password,
        url='https://localhost:8089',
        verify=False,
        ssl_options=None):
    
    servercontent = requests.post(
        '{}/services/auth/login'.format(
            url),
        headers={},
        verify=False,
        data={
            'username': user,
            'password': password
        })
    get_session_key = parseString(
        servercontent.text).getElementsByTagName(
            'sessionKey')[0].childNodes[0].nodeValue
    return get_session_key