implements Key, PublicKey, PrivateKey : Key « Security « Java Tutorial






import java.security.Key;
import java.security.PrivateKey;
import java.security.PublicKey;

public class XYZKey implements Key, PublicKey, PrivateKey {
  int rotValue;

  public String getAlgorithm() {
    return "XYZ";
  }

  public String getFormat() {
    return "XYZ Special Format";
  }

  public byte[] getEncoded() {
    byte b[] = new byte[4];
    b[3] = (byte) ((rotValue << 24) & 0xff);
    b[2] = (byte) ((rotValue << 16) & 0xff);
    b[1] = (byte) ((rotValue << 8) & 0xff);
    b[0] = (byte) ((rotValue << 0) & 0xff);
    return b;
  }
}








36.20.Key
36.20.1.DES Key Agreement
36.20.2.PBE key spec
36.20.3.Key Agreement
36.20.4.Use DSAKey
36.20.5.Rich DES Key
36.20.6.implements Key, PublicKey, PrivateKey