home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / security / Signer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  1.5 KB  |  50 lines

  1. package java.security;
  2.  
  3. public abstract class Signer extends Identity {
  4.    private PrivateKey privateKey;
  5.  
  6.    protected Signer() {
  7.    }
  8.  
  9.    public Signer(String var1) {
  10.       super(var1);
  11.    }
  12.  
  13.    public Signer(String var1, IdentityScope var2) throws KeyManagementException {
  14.       super(var1, var2);
  15.    }
  16.  
  17.    public PrivateKey getPrivateKey() {
  18.       ((Identity)this).check("get.private.key");
  19.       return this.privateKey;
  20.    }
  21.  
  22.    public final void setKeyPair(KeyPair var1) throws InvalidParameterException, KeyException {
  23.       ((Identity)this).check("set.private.keypair");
  24.       PublicKey var2 = var1.getPublic();
  25.       PrivateKey var3 = var1.getPrivate();
  26.       if (var2 != null && var3 != null) {
  27.          ((Identity)this).setPublicKey(var2);
  28.          this.privateKey = var3;
  29.       } else {
  30.          throw new InvalidParameterException();
  31.       }
  32.    }
  33.  
  34.    String printKeys() {
  35.       String var1 = "";
  36.       PublicKey var2 = ((Identity)this).getPublicKey();
  37.       if (var2 != null && this.privateKey != null) {
  38.          var1 = "\tpublic and private keys initialized";
  39.       } else {
  40.          var1 = "\tno keys";
  41.       }
  42.  
  43.       return var1;
  44.    }
  45.  
  46.    public String toString() {
  47.       return "[Signer]" + super.toString();
  48.    }
  49. }
  50.