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


Java ECKeyPair.getPrivateKey方法代码示例

本文整理汇总了Java中org.whispersystems.libaxolotl.ecc.ECKeyPair.getPrivateKey方法的典型用法代码示例。如果您正苦于以下问题:Java ECKeyPair.getPrivateKey方法的具体用法?Java ECKeyPair.getPrivateKey怎么用?Java ECKeyPair.getPrivateKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.whispersystems.libaxolotl.ecc.ECKeyPair的用法示例。


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

示例1: generateAsymmetricMasterSecret

import org.whispersystems.libaxolotl.ecc.ECKeyPair; //导入方法依赖的package包/类
public static AsymmetricMasterSecret generateAsymmetricMasterSecret(Context context,
                                                                    MasterSecret masterSecret)
{
  MasterCipher masterCipher = new MasterCipher(masterSecret);
  ECKeyPair    keyPair      = Curve.generateKeyPair();

  save(context, ASYMMETRIC_LOCAL_PUBLIC_DJB, keyPair.getPublicKey().serialize());
  save(context, ASYMMETRIC_LOCAL_PRIVATE_DJB, masterCipher.encryptKey(keyPair.getPrivateKey()));

  return new AsymmetricMasterSecret(keyPair.getPublicKey(), keyPair.getPrivateKey());
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:12,代码来源:MasterSecretUtil.java

示例2: initializeSessionsV2

import org.whispersystems.libaxolotl.ecc.ECKeyPair; //导入方法依赖的package包/类
private void initializeSessionsV2(SessionState aliceSessionState, SessionState bobSessionState)
    throws InvalidKeyException
{
  ECKeyPair       aliceIdentityKeyPair = Curve.generateKeyPair();
  IdentityKeyPair aliceIdentityKey     = new IdentityKeyPair(new IdentityKey(aliceIdentityKeyPair.getPublicKey()),
                                                             aliceIdentityKeyPair.getPrivateKey());
  ECKeyPair       aliceBaseKey         = Curve.generateKeyPair();
  ECKeyPair       aliceEphemeralKey    = Curve.generateKeyPair();

  ECKeyPair       bobIdentityKeyPair   = Curve.generateKeyPair();
  IdentityKeyPair bobIdentityKey       = new IdentityKeyPair(new IdentityKey(bobIdentityKeyPair.getPublicKey()),
                                                             bobIdentityKeyPair.getPrivateKey());
  ECKeyPair       bobBaseKey           = Curve.generateKeyPair();
  ECKeyPair       bobEphemeralKey      = bobBaseKey;

  AliceAxolotlParameters aliceParameters = AliceAxolotlParameters.newBuilder()
      .setOurIdentityKey(aliceIdentityKey)
      .setOurBaseKey(aliceBaseKey)
      .setTheirIdentityKey(bobIdentityKey.getPublicKey())
      .setTheirSignedPreKey(bobEphemeralKey.getPublicKey())
      .setTheirRatchetKey(bobEphemeralKey.getPublicKey())
      .setTheirOneTimePreKey(Optional.<ECPublicKey>absent())
      .create();

  BobAxolotlParameters bobParameters = BobAxolotlParameters.newBuilder()
      .setOurIdentityKey(bobIdentityKey)
      .setOurOneTimePreKey(Optional.<ECKeyPair>absent())
      .setOurRatchetKey(bobEphemeralKey)
      .setOurSignedPreKey(bobBaseKey)
      .setTheirBaseKey(aliceBaseKey.getPublicKey())
      .setTheirIdentityKey(aliceIdentityKey.getPublicKey())
      .create();

  RatchetingSession.initializeSession(aliceSessionState, 2, aliceParameters);
  RatchetingSession.initializeSession(bobSessionState, 2, bobParameters);
}
 
开发者ID:Securecom,项目名称:Securecom-Messaging,代码行数:37,代码来源:SessionCipherTest.java

示例3: initializeSessionsV3

import org.whispersystems.libaxolotl.ecc.ECKeyPair; //导入方法依赖的package包/类
private void initializeSessionsV3(SessionState aliceSessionState, SessionState bobSessionState)
    throws InvalidKeyException
{
  ECKeyPair       aliceIdentityKeyPair = Curve.generateKeyPair();
  IdentityKeyPair aliceIdentityKey     = new IdentityKeyPair(new IdentityKey(aliceIdentityKeyPair.getPublicKey()),
                                                             aliceIdentityKeyPair.getPrivateKey());
  ECKeyPair       aliceBaseKey         = Curve.generateKeyPair();
  ECKeyPair       aliceEphemeralKey    = Curve.generateKeyPair();

  ECKeyPair       alicePreKey          = aliceBaseKey;

  ECKeyPair       bobIdentityKeyPair   = Curve.generateKeyPair();
  IdentityKeyPair bobIdentityKey       = new IdentityKeyPair(new IdentityKey(bobIdentityKeyPair.getPublicKey()),
                                                             bobIdentityKeyPair.getPrivateKey());
  ECKeyPair       bobBaseKey           = Curve.generateKeyPair();
  ECKeyPair       bobEphemeralKey      = bobBaseKey;

  ECKeyPair       bobPreKey            = Curve.generateKeyPair();

  AliceAxolotlParameters aliceParameters = AliceAxolotlParameters.newBuilder()
      .setOurBaseKey(aliceBaseKey)
      .setOurIdentityKey(aliceIdentityKey)
      .setTheirOneTimePreKey(Optional.<ECPublicKey>absent())
      .setTheirRatchetKey(bobEphemeralKey.getPublicKey())
      .setTheirSignedPreKey(bobBaseKey.getPublicKey())
      .setTheirIdentityKey(bobIdentityKey.getPublicKey())
      .create();

  BobAxolotlParameters bobParameters = BobAxolotlParameters.newBuilder()
      .setOurRatchetKey(bobEphemeralKey)
      .setOurSignedPreKey(bobBaseKey)
      .setOurOneTimePreKey(Optional.<ECKeyPair>absent())
      .setOurIdentityKey(bobIdentityKey)
      .setTheirIdentityKey(aliceIdentityKey.getPublicKey())
      .setTheirBaseKey(aliceBaseKey.getPublicKey())
      .create();

  RatchetingSession.initializeSession(aliceSessionState, 3, aliceParameters);
  RatchetingSession.initializeSession(bobSessionState, 3, bobParameters);
}
 
开发者ID:Securecom,项目名称:Securecom-Messaging,代码行数:41,代码来源:SessionCipherTest.java

示例4: InMemoryIdentityKeyStore

import org.whispersystems.libaxolotl.ecc.ECKeyPair; //导入方法依赖的package包/类
public InMemoryIdentityKeyStore() {
  try {
    ECKeyPair identityKeyPairKeys = Curve.generateKeyPair();

    this.identityKeyPair = new IdentityKeyPair(new IdentityKey(identityKeyPairKeys.getPublicKey()),
                                               identityKeyPairKeys.getPrivateKey());
    this.localRegistrationId = SecureRandom.getInstance("SHA1PRNG").nextInt(16380) + 1;
  } catch (NoSuchAlgorithmException e) {
    throw new AssertionError(e);
  }
}
 
开发者ID:Securecom,项目名称:Securecom-Messaging,代码行数:12,代码来源:InMemoryIdentityKeyStore.java

示例5: generateIdentityKeyPair

import org.whispersystems.libaxolotl.ecc.ECKeyPair; //导入方法依赖的package包/类
private static IdentityKeyPair generateIdentityKeyPair() {
	Log.i(Config.LOGTAG, AxolotlService.LOGPREFIX + " : " + "Generating axolotl IdentityKeyPair...");
	ECKeyPair identityKeyPairKeys = Curve.generateKeyPair();
	return new IdentityKeyPair(new IdentityKey(identityKeyPairKeys.getPublicKey()),
			identityKeyPairKeys.getPrivateKey());
}
 
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:7,代码来源:SQLiteAxolotlStore.java

示例6: generateIdentityKeyPair

import org.whispersystems.libaxolotl.ecc.ECKeyPair; //导入方法依赖的package包/类
/**
 * Generate an identity key pair.  Clients should only do this once,
 * at install time.
 *
 * @return the generated IdentityKeyPair.
 */
public static IdentityKeyPair generateIdentityKeyPair() {
  ECKeyPair   keyPair   = Curve.generateKeyPair();
  IdentityKey publicKey = new IdentityKey(keyPair.getPublicKey());
  return new IdentityKeyPair(publicKey, keyPair.getPrivateKey());
}
 
开发者ID:Securecom,项目名称:Securecom-Messaging,代码行数:12,代码来源:KeyHelper.java


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