It seems we have two ways of expressing a DSAPublicKey as bytes. The first
way we write to an output stream the public key and then the group, and the
other we return the group then the public key as bytes. The usage of both of
these can be seen in FnpLink. (note: it could very well be a crypto thing
since we feed DSAPublicKey.asBytes to sha, but I don't think it is)

public class DSAPublicKey extends CryptoKey {
  public void writeForWire(OutputStream out) throws IOException {
    Util.writeMPI(y, out);
    group.writeForWire(out);
  }

  public byte[] asBytes() {
    byte[] groupBytes=group.asBytes();
    byte[] ybytes=Util.MPIbytes(y);
    byte[] bytes=new byte[groupBytes.length + ybytes.length];
    System.arraycopy(groupBytes, 0, bytes, 0, groupBytes.length);
    System.arraycopy(ybytes, 0, bytes, groupBytes.length, ybytes.length);
    return bytes;
  }
}

-Mathew

_______________________________________________
Devl mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to