All Implemented Interfaces:
Serializable, DataStructure

public class VerifiedDestinationextends Destination
Extend Destination with methods to verify its Certificate. The router does not check Certificates, it doesn't care. Apps however (particularly addressbook) may wish to enforce various cert content, format, and policies. This class is written such that apps may extend it to create their own policies.
See Also:
  • Field Details

    • CERTIFICATE_LENGTH_SIGNED

      public static final int CERTIFICATE_LENGTH_SIGNED
      Defaults for Signed Certs.
    • CERTIFICATE_LENGTH_SIGNED_WITH_HASH

      public static final int CERTIFICATE_LENGTH_SIGNED_WITH_HASH
      Length of a signed certificate including the signer hash.
  • Constructor Details

    • VerifiedDestination

      public VerifiedDestination()
      Creates a new VerifiedDestination with default values.
    • VerifiedDestination

      public VerifiedDestination(String s) throws DataFormatException
      Alternative constructor which takes a base64 string representation.
      Parameters:
      s - a Base64 representation of the destination, as (eg) is used in hosts.txt
      Throws:
      DataFormatException - if the string does not decode to a full-length destination
    • VerifiedDestination

      public VerifiedDestination(Destination d) throws DataFormatException
      Create from an existing Dest.
      Parameters:
      d - must be non-null
      Throws:
      DataFormatException - if the source destination's base64 form cannot be parsed
  • Method Details

    • verifyCert

      public boolean verifyCert(boolean allowNone)
      Verify the certificate.
      Parameters:
      allowNone - If true, allow a NULL or HIDDEN certificate.
      Returns:
      true if the certificate is valid
    • verifySignedCert

      protected boolean verifySignedCert()
      Signed Certs are signed by a 3rd-party Destination. They can be used for a second-level domain, for example, to sign the Destination for a third-level domain. Or for a central authority to approve a destination.

      We define a Signed Certificate as follows: - length: Either 44 or 72 bytes - contents: 1: a 44 byte Signature 2 (optional): a 32 byte Hash of the signing Destination This can be a hint to the verification process to help find the identity and keys of the signing Destination. Data which is signed: The first 384 bytes of the Destination (i.e. the Public Key and Signing Public Key, WITHOUT the Certificate)

      It is not appropriate to enforce a particular delegation scheme here. The application will need to apply additional steps to select an appropriate signing Destination and verify the signature.

      See PrivateKeyFile.verifySignature(Destination) for sample verification code.

      Returns:
      true if the signed certificate payload length is valid
    • verifyUnknownCert

      protected boolean verifyUnknownCert()
      Reject all unknown certs.
      Returns:
      false always
    • toString

      public String toString()
      Returns a string representation including verification status.
      Overrides:
      toString in class KeysAndCert