2011-12-20 10:20:44 -08:00
|
|
|
/**
|
|
|
|
* Copyright (C) 2011 Whisper Systems
|
2013-11-10 04:15:29 -08:00
|
|
|
* Copyright (C) 2013 Open Whisper Systems
|
2011-12-20 10:20:44 -08:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
package org.thoughtcrime.securesms.crypto;
|
|
|
|
|
2014-04-21 08:40:19 -07:00
|
|
|
import org.whispersystems.libaxolotl.ecc.ECPrivateKey;
|
|
|
|
import org.whispersystems.libaxolotl.ecc.ECPublicKey;
|
2011-12-20 10:20:44 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* When a user first initializes TextSecure, a few secrets
|
|
|
|
* are generated. These are:
|
|
|
|
*
|
|
|
|
* 1) A 128bit symmetric encryption key.
|
|
|
|
* 2) A 160bit symmetric MAC key.
|
|
|
|
* 3) An ECC keypair.
|
|
|
|
*
|
|
|
|
* The first two, along with the ECC keypair's private key, are
|
|
|
|
* then encrypted on disk using PBE.
|
|
|
|
*
|
|
|
|
* This class represents the ECC keypair.
|
|
|
|
*
|
|
|
|
* @author Moxie Marlinspike
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class AsymmetricMasterSecret {
|
|
|
|
|
2014-04-21 08:40:19 -07:00
|
|
|
private final ECPublicKey djbPublicKey;
|
2013-11-10 04:15:29 -08:00
|
|
|
private final ECPrivateKey djbPrivateKey;
|
|
|
|
|
|
|
|
|
2014-04-09 20:02:46 -07:00
|
|
|
public AsymmetricMasterSecret(ECPublicKey djbPublicKey, ECPrivateKey djbPrivateKey)
|
2013-11-10 04:15:29 -08:00
|
|
|
{
|
|
|
|
this.djbPublicKey = djbPublicKey;
|
|
|
|
this.djbPrivateKey = djbPrivateKey;
|
2011-12-20 10:20:44 -08:00
|
|
|
}
|
2013-11-10 04:15:29 -08:00
|
|
|
|
|
|
|
public ECPublicKey getDjbPublicKey() {
|
|
|
|
return djbPublicKey;
|
2011-12-20 10:20:44 -08:00
|
|
|
}
|
2013-11-10 04:15:29 -08:00
|
|
|
|
|
|
|
|
2014-04-09 20:02:46 -07:00
|
|
|
public ECPrivateKey getPrivateKey() {
|
|
|
|
return djbPrivateKey;
|
2013-11-10 04:15:29 -08:00
|
|
|
}
|
|
|
|
|
2011-12-20 10:20:44 -08:00
|
|
|
}
|