当前位置: 首页>>代码示例>>Java>>正文


Java PassphraseSecrets类代码示例

本文整理汇总了Java中info.guardianproject.cacheword.PassphraseSecrets的典型用法代码示例。如果您正苦于以下问题:Java PassphraseSecrets类的具体用法?Java PassphraseSecrets怎么用?Java PassphraseSecrets使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PassphraseSecrets类属于info.guardianproject.cacheword包,在下文中一共展示了PassphraseSecrets类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeWithPassphrase

import info.guardianproject.cacheword.PassphraseSecrets; //导入依赖的package包/类
private void initializeWithPassphrase() {
    try {
        String passphrase = mNewPassphrase.getText().toString();
        if (!passphrase.isEmpty()) {

            PassphraseSecrets p = (PassphraseSecrets)mCacheWord.getCachedSecrets();
            mCacheWord.changePassphrase(p,passphrase.toCharArray());

            //now remove the temp passphrase if it exists
            SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
            if (settings.contains(ImApp.PREFERENCE_KEY_TEMP_PASS))
                settings.edit().remove(ImApp.PREFERENCE_KEY_TEMP_PASS).commit();

            finish();

        }

    } catch (Exception e) {
        // TODO initialization failed
        Log.e(TAG, "Cacheword pass initialization failed: " + e.getMessage());
    }
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:23,代码来源:LockScreenActivity.java

示例2: resetPassphrase

import info.guardianproject.cacheword.PassphraseSecrets; //导入依赖的package包/类
void resetPassphrase () {

        //set temporary passphrase
        try {
            PassphraseSecrets p = (PassphraseSecrets)mCacheWord.getCachedSecrets();

            if (p != null) {
                String tempPassphrase = UUID.randomUUID().toString();
                SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
                settings.edit().putString(ImApp.PREFERENCE_KEY_TEMP_PASS, tempPassphrase).apply();
                mCacheWord.changePassphrase(p, tempPassphrase.toCharArray());
            }

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


    }
 
开发者ID:zom,项目名称:Zom-Android,代码行数:21,代码来源:LockScreenActivity.java

示例3: changeDatabasePassphrase

import info.guardianproject.cacheword.PassphraseSecrets; //导入依赖的package包/类
/**
  * Changes the database passphrase
  * 
  * @param newPassphrase - The new passphrase
  * 
  * @return A boolean indicating whether or not the database passphrase was
  * changed successfully
  */
 public static boolean changeDatabasePassphrase(String newPassphrase)
 {
 	Log.i(TAG, "DatabaseContentProvider.changeDatabasePassphrase() called");
 	
 	try
 	{
  	// Get the old encryption key
 		String oldEncryptionKey = DatabaseHelper.encodeRawKeyToStr(sCacheWordHandler.getEncryptionKey());
 		
 		// Set CacheWord to use the new passphrase
sCacheWordHandler.changePassphrase((PassphraseSecrets) sCacheWordHandler.getCachedSecrets(), newPassphrase.toCharArray());

// Get the new encryption key
String newEncryptionKey = DatabaseHelper.encodeRawKeyToStr(sCacheWordHandler.getEncryptionKey());
  	
  	sDatabase.execSQL("PRAGMA key = \"" + oldEncryptionKey + "\";");
  	sDatabase.execSQL("PRAGMA rekey = \"" + newEncryptionKey + "\";");
  	
  	openDatabase();
  	return true;
 	}
 	catch (Exception e)
 	{
 		Log.e(TAG, "Exception occurred while running DatabaseContentProvider.changeDatabasePassphrase(). The exception message was:\n" + 
 				e.getMessage());
 		return false;
 	}
 }
 
开发者ID:JonathanCoe,项目名称:bitseal,代码行数:37,代码来源:DatabaseContentProvider.java

示例4: setAuthToken

import info.guardianproject.cacheword.PassphraseSecrets; //导入依赖的package包/类
public byte[] setAuthToken(String authToken) {
	SecretKey key = ((PassphraseSecrets) cacheWord.getCachedSecrets()).getSecretKey();
	return AesUtility.EncryptToKey(key, authToken).getBytes(Wiper.Utf8CharSet);
}
 
开发者ID:guardianproject,项目名称:CameraV,代码行数:5,代码来源:CredentialManager.java


注:本文中的info.guardianproject.cacheword.PassphraseSecrets类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。