Examples of CipherSession


Examples of org.syncany.crypto.CipherSession

    this.cipherSession = null;
  }
 
    public CipherTransformer(List<CipherSpec> cipherSpecs, SaltedSecretKey masterKey) {
      this.cipherSpecs = cipherSpecs;
      this.cipherSession = new CipherSession(masterKey);
    }   
View Full Code Here

Examples of org.syncany.crypto.CipherSession

  private void initCipherSession(String masterKeyStr, String masterKeySaltStr) {
    byte[] masterKeySalt = StringUtil.fromHex(masterKeySaltStr);
    byte[] masterKeyBytes = StringUtil.fromHex(masterKeyStr);
   
    SaltedSecretKey masterKey = new SaltedSecretKey(new SecretKeySpec(masterKeyBytes, "RAW"), masterKeySalt);   
    cipherSession = new CipherSession(masterKey);
  }
View Full Code Here

Examples of org.syncany.crypto.CipherSession

  }
 
  @Test
  public void testCipherSessionWriteKeyReuseCountOfTwo() throws Exception {
    SaltedSecretKey masterKey = createDummyMasterKey();   
    CipherSession cipherSession = new CipherSession(masterKey, 999, 2);
   
    CipherSpec cipherSpecAes128 = CipherSpecs.getCipherSpec(CipherSpecs.AES_128_GCM);
    CipherSpec cipherSpecTwofish128 = CipherSpecs.getCipherSpec(CipherSpecs.TWOFISH_128_GCM);
   
    SaltedSecretKey writeSecretKey1Aes128 = cipherSession.getWriteSecretKey(cipherSpecAes128);
    SaltedSecretKey writeSecretKey2Aes128 = cipherSession.getWriteSecretKey(cipherSpecAes128);
    SaltedSecretKey writeSecretKey3Aes128 = cipherSession.getWriteSecretKey(cipherSpecAes128);
   
    SaltedSecretKey writeSecretKey1Twofish128 = cipherSession.getWriteSecretKey(cipherSpecTwofish128);
    SaltedSecretKey writeSecretKey2Twofish128 = cipherSession.getWriteSecretKey(cipherSpecTwofish128);
    SaltedSecretKey writeSecretKey3Twofish128 = cipherSession.getWriteSecretKey(cipherSpecTwofish128);
       
    assertEquals(writeSecretKey1Aes128, writeSecretKey2Aes128);
    assertNotSame(writeSecretKey1Aes128, writeSecretKey3Aes128);
   
    assertEquals(writeSecretKey1Twofish128, writeSecretKey2Twofish128);
View Full Code Here

Examples of org.syncany.crypto.CipherSession

 
 
  @Test
  public void testCipherSessionReadKeyCacheSizeOfThree() throws Exception {
    SaltedSecretKey masterKey = createDummyMasterKey();   
    CipherSession cipherSession = new CipherSession(masterKey, 2, 999);
   
    CipherSpec cipherSpecAes128 = CipherSpecs.getCipherSpec(CipherSpecs.AES_128_GCM);
   
    byte[] readKeySalt1 = CipherUtil.createRandomArray(cipherSpecAes128.getKeySize());
    byte[] readKeySalt2 = CipherUtil.createRandomArray(cipherSpecAes128.getKeySize());
    byte[] readKeySalt3 = CipherUtil.createRandomArray(cipherSpecAes128.getKeySize());       
   
    SaltedSecretKey readSecretKey1Aes128 = cipherSession.getReadSecretKey(cipherSpecAes128, readKeySalt1);
    SaltedSecretKey readSecretKey2Aes128 = cipherSession.getReadSecretKey(cipherSpecAes128, readKeySalt2);
    SaltedSecretKey readSecretKey3Aes128 = cipherSession.getReadSecretKey(cipherSpecAes128, readKeySalt3);
   
    assertNotSame(readSecretKey1Aes128, readSecretKey2Aes128);
    assertNotSame(readSecretKey1Aes128, readSecretKey3Aes128);
    assertNotSame(readSecretKey2Aes128, readSecretKey3Aes128);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.