Changeset 70d9415


Ignore:
Timestamp:
Sep 6, 2011 1:23:24 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
73901f6
Parents:
d9b37ac
Message:

more constructors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/data/PrivateKeyFile.java

    rd9b37ac r70d9415  
    128128    }
    129129   
     130    /** @since 0.8.9 */
     131    public PrivateKeyFile(File file, I2PSession session) {
     132        this(file, session.getMyDestination(), session.getDecryptionKey(), session.getPrivateKey());
     133    }
     134   
     135    /** @since 0.8.9 */
     136    public PrivateKeyFile(File file, Destination dest, PrivateKey pk, SigningPrivateKey spk) {
     137        this.file = file;
     138        this.client = null;
     139        this.dest = dest;
     140        this.privKey = pk;
     141        this.signingPrivKey = spk;
     142    }
     143   
     144    /** @since 0.8.9 */
     145    public PrivateKeyFile(File file, PublicKey pubkey, SigningPublicKey spubkey, Certificate cert,
     146                          PrivateKey pk, SigningPrivateKey spk) {
     147        this.file = file;
     148        this.client = null;
     149        this.dest = new Destination();
     150        this.dest.setPublicKey(pubkey);
     151        this.dest.setSigningPublicKey(spubkey);
     152        this.dest.setCertificate(cert);
     153        this.privKey = pk;
     154        this.signingPrivKey = spk;
     155    }
    130156   
    131157    /** Also reads in the file to get the privKey and signingPrivKey,
     
    137163            try {
    138164                out = new FileOutputStream(this.file);
    139                 this.client.createDestination(out);
     165                if (this.client != null)
     166                    this.client.createDestination(out);
     167                else
     168                    write();
    140169            } finally {
    141170                if (out != null) {
     
    412441   
    413442   
    414     private File file;
    415     private I2PClient client;
     443    private final File file;
     444    private final I2PClient client;
    416445    private Destination dest;
    417446    private PrivateKey privKey;
Note: See TracChangeset for help on using the changeset viewer.