freiheit.com technologies gmbh

## com.freiheit.gnupg
Class GnuPGKey

    java.lang.Object
      com.freiheit.gnupg.GnuPGPeer
          com.freiheit.gnupg.GnuPGKey

    public class GnuPGKey

extends GnuPGPeer

Represents a key. You can manage and find keys using GnuPGContext. You can not instantiate a key by yourself. You always need a context.

Author:
  Stefan Richter, stefan@freiheit.com
See Also:
  `GnuPGContext`

Constructor Summary
`protected` `GnuPGKey(GnuPGContext context, java.lang.String fingerprint)`
`protected` `GnuPGKey(int ptr)` This constructor is only called from within the JNI routines.

Method Summary
`void` `destroy()` This calls immediately the release method for the datastructure in the underlying gpgme library.
`protected void` `finalize()` Releases underlying datastructures.
`java.lang.String` `getComment()` Get the Comment of the default key/userid.
`java.lang.String` `getEmail()` Get the Email-Address of the default key/userid.
`java.lang.String` `getFingerprint()` Get the Fingerprint of the default key/userid.
`java.lang.String` `getKeyID()` Get the Key-ID of the default key/userid.
`java.lang.String` `getName()` Get the Name of the default key/userid.
`java.util.Iterator` `getSignatures()` Lists all signatures of the default key/userid.
`java.lang.String` `getUserID()` Get the User-ID of the default key/userid.
`java.lang.String` `toString()` Return this key with all of its signatures.

Methods inherited from class com.freiheit.gnupg.GnuPGPeer
`getInternalRepresentation, setInternalRepresentation`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### GnuPGKey

    protected GnuPGKey(int ptr)

  This constructor is only called from within the JNI routines. This is for example used, when a keylist search returns keys. This is how then each key is instantiated on the java side from c.

### GnuPGKey

    protected GnuPGKey(GnuPGContext context,
                       java.lang.String fingerprint)

Method Detail

### getName

    public java.lang.String getName()

  Get the Name of the default key/userid.

### getEmail

    public java.lang.String getEmail()

  Get the Email-Address of the default key/userid.

### getKeyID

    public java.lang.String getKeyID()

  Get the Key-ID of the default key/userid.

### getFingerprint

    public java.lang.String getFingerprint()

  Get the Fingerprint of the default key/userid.

### getComment

    public java.lang.String getComment()

  Get the Comment of the default key/userid.

### getUserID

    public java.lang.String getUserID()

  Get the User-ID of the default key/userid.

### getSignatures

    public java.util.Iterator getSignatures()

  Lists all signatures of the default key/userid. Every key can have multiple signatures. Signatures can be incomplete. This means, that not all details (name, email-address etc.) were downloaded from a keyserver. But you will at least see the key-id of the signature. Use GnuPG to --refresh-keys if you want to see all signature details.

  Currently I am not supporting java generics for a type safe iterator, because there are to many people still using jdk-1.4.x without generics support. This will be changed on increasing demand.

  Returns:
    Iterator of GnuPGSignature objects
  See Also:
    `GnuPGSignature`

### toString

    public java.lang.String toString()

  Return this key with all of its signatures.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    String multiline text with one key and 0..many signatures

### destroy

    public void destroy()

  This calls immediately the release method for the datastructure in the underlying gpgme library. This method is called by the finalizer of the class anyway, but you can call it yourself if you want to get rid of this datastructure at once and don't want to wait for the non-deterministic garbage-collector of the JVM.

### finalize

    protected void finalize()

  Releases underlying datastructures. Simple calls the destroy() method.

  Overrides:
    `finalize` in class `java.lang.Object`

freiheit.com technologies gmbh

© 2005 freiheit.com technologies gmbh