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


Java Crypto类代码示例

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


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

示例1: BaseConcealPreference

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public BaseConcealPreference(
    final Crypto crypto,
    final SharedPreferences preferences,
    final String key,
    final T defaultValue) {
  this.defaultValue = defaultValue;
  this.stringPreference =
      new ConcealStringPreference(crypto, preferences, key, String.valueOf(defaultValue));
}
 
开发者ID:prolificinteractive,项目名称:Patrons,代码行数:10,代码来源:BaseConcealPreference.java

示例2: ConcealIntPreference

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public ConcealIntPreference(
    final Crypto crypto,
    final SharedPreferences preferences,
    final String key,
    final int defaultValue) {
  super(crypto, preferences, key, defaultValue);
}
 
开发者ID:prolificinteractive,项目名称:Patrons,代码行数:8,代码来源:ConcealIntPreference.java

示例3: ConcealFloatPreference

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public ConcealFloatPreference(
    final Crypto crypto,
    final SharedPreferences preferences,
    final String key,
    final float defaultValue) {
  super(crypto, preferences, key, defaultValue);
}
 
开发者ID:prolificinteractive,项目名称:Patrons,代码行数:8,代码来源:ConcealFloatPreference.java

示例4: ConcealStringSetPreference

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public ConcealStringSetPreference(
    final Crypto crypto,
    final SharedPreferences preferences,
    final String key,
    final Set<String> defaultValue) {
  super(preferences, key, defaultValue);
  this.crypto = crypto;
  this.entity = Entity.create(key);
}
 
开发者ID:prolificinteractive,项目名称:Patrons,代码行数:10,代码来源:ConcealStringSetPreference.java

示例5: ConcealBooleanPreference

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public ConcealBooleanPreference(
    final Crypto crypto,
    final SharedPreferences preferences,
    final String key,
    final boolean defaultValue) {
  super(crypto, preferences, key, defaultValue);
}
 
开发者ID:prolificinteractive,项目名称:Patrons,代码行数:8,代码来源:ConcealBooleanPreference.java

示例6: ConcealLongPreference

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public ConcealLongPreference(
    final Crypto crypto,
    final SharedPreferences preferences,
    final String key,
    final long defaultValue) {
  super(crypto, preferences, key, defaultValue);
}
 
开发者ID:prolificinteractive,项目名称:Patrons,代码行数:8,代码来源:ConcealLongPreference.java

示例7: ConcealStringPreference

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public ConcealStringPreference(
    final Crypto crypto,
    final SharedPreferences preferences,
    final String key,
    final String defaultValue) {
  super(preferences, key, defaultValue);
  this.crypto = crypto;
  this.entity = Entity.create(key);
}
 
开发者ID:prolificinteractive,项目名称:Patrons,代码行数:10,代码来源:ConcealStringPreference.java

示例8: setUp

import com.facebook.crypto.Crypto; //导入依赖的package包/类
@Before public void setUp() throws Exception {
  SoLoader.init(InstrumentationRegistry.getContext(), false);


  final SharedPreferences prefs =
      PreferenceManager.getDefaultSharedPreferences(InstrumentationRegistry.getContext());
  final Crypto crypto = AndroidConceal
      .get()
      .createDefaultCrypto(new SharedPrefsBackedKeyChain(
          InstrumentationRegistry.getContext(),
          CryptoConfig.KEY_256
      ));

  factory = new ConcealPreferenceFactory(crypto, prefs);
}
 
开发者ID:prolificinteractive,项目名称:Patrons,代码行数:16,代码来源:ConcealIntPreferenceTest.java

示例9: setUp

import com.facebook.crypto.Crypto; //导入依赖的package包/类
@Before public void setUp() throws Exception {
  final SharedPreferences prefs =
      PreferenceManager.getDefaultSharedPreferences(InstrumentationRegistry.getContext());
  final Crypto crypto = AndroidConceal
      .get()
      .createDefaultCrypto(new SharedPrefsBackedKeyChain(
          InstrumentationRegistry.getContext(),
          CryptoConfig.KEY_256
      ));

  factory = new ConcealPreferenceFactory(crypto, prefs);
}
 
开发者ID:prolificinteractive,项目名称:Patrons,代码行数:13,代码来源:ConcealIntPreferenceTest.java

示例10: ICSNativeStringEncryption

import com.facebook.crypto.Crypto; //导入依赖的package包/类
ICSNativeStringEncryption(String password) {
    this.password = password;
    this.hashing = new Hashing();
    this.encoding = new Encoding();

    SystemNativeCryptoLibrary nativeCryptoLibrary = new SystemNativeCryptoLibrary();
    MemoryKeyChain keyChain = new MemoryKeyChain(CryptoConfig.KEY_256, password, nativeCryptoLibrary);
    this.crypto = new Crypto(keyChain, nativeCryptoLibrary, CryptoConfig.KEY_256);
}
 
开发者ID:marius-bardan,项目名称:encryptedprefs,代码行数:10,代码来源:ICSNativeStringEncryption.java

示例11: DiskCache

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public DiskCache(Context context, String category) {
    mCrypto = new Crypto(
            new SharedPrefsBackedKeyChain(context),
            new SystemNativeCryptoLibrary());

    mCacheDir = new File(category);
    if (mCacheDir.exists()) {
        isLazyInit = true;
        mCache = new DiskBasedCache(mCacheDir, DEFAULT_DISK_USAGE_BYTES);
        initialize();
    }
}
 
开发者ID:AndroidCoderTools,项目名称:coder-tools-object-cacher,代码行数:13,代码来源:DiskCache.java

示例12: CryptoManager

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public CryptoManager(Context context, String path, String password) {
    this.path = path;
    this.crypto = new Crypto(
            new SharedPrefsBackedKeyChain(context),
            new SystemNativeCryptoLibrary());
    entity = new Entity(password);
    checkPathExists();
}
 
开发者ID:kikoso,项目名称:DroidCon-Poland,代码行数:9,代码来源:CryptoManager.java

示例13: encryptingContent

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public static void encryptingContent(Context context, File file, byte[] plainTextBytes) throws Exception {
// Creates a new Crypto object with default implementations of
// a key chain as well as native library.
        Crypto crypto = new Crypto(
                new SharedPrefsBackedKeyChain(context),
                new SystemNativeCryptoLibrary());


// Check for whether the crypto functionality is available
// This might fail if android does not load libaries correctly.
        if (!crypto.isAvailable()) {
            return;
        }

        OutputStream fileStream = new BufferedOutputStream(
                new FileOutputStream(file));

// Creates an output stream which encrypts the data as
// it is written to it and writes it out to the file.
        OutputStream outputStream = crypto.getCipherOutputStream(
                fileStream,
                new Entity("TEST1"));

// Write plaintext to it.
        outputStream.write(plainTextBytes);
        outputStream.close();
    }
 
开发者ID:cymcsg,项目名称:UltimateAndroid,代码行数:28,代码来源:CryptoUtils.java

示例14: decryptingContent

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public static void decryptingContent(Context context, File file, String newPath) throws Exception {
        // Get the file to which ciphertext has been written.
        FileInputStream fileStream = new FileInputStream(file);
        Crypto crypto = new Crypto(
                new SharedPrefsBackedKeyChain(context),
                new SystemNativeCryptoLibrary());
// Creates an input stream which decrypts the data as
// it is read from it.
        InputStream inputStream = crypto.getCipherInputStream(
                fileStream,
                new Entity("TEST1"));

// Read into a byte array.
        int read;
        byte[] buffer = new byte[1024];

// You must read the entire stream to completion.
// The verification is done at the end of the stream.
// Thus not reading till the end of the stream will cause
// a security bug.
        FileOutputStream fs = new FileOutputStream(newPath);
        while ((read = inputStream.read(buffer)) != -1) {
            fs.write(buffer, 0, read);
        }

        inputStream.close();
    }
 
开发者ID:cymcsg,项目名称:UltimateAndroid,代码行数:28,代码来源:CryptoUtils.java

示例15: getCrypto

import com.facebook.crypto.Crypto; //导入依赖的package包/类
public Crypto getCrypto(){
    return crypto;
}
 
开发者ID:afiqiqmal,项目名称:ConcealSharedPreference-Android,代码行数:4,代码来源:ConcealCrypto.java


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