net.i2p.data

## Class VerifiedDestination

- java.lang.Object
- - net.i2p.data.DataStructureImpl
  - - net.i2p.data.KeysAndCert
    - - net.i2p.data.Destination
      - - net.i2p.data.VerifiedDestination

- All Implemented Interfaces:
    Serializable, DataStructure

      public class VerifiedDestination
      extends 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:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CERTIFICATE_LENGTH_SIGNED` Defaults for Signed Certs
    `static int` | `CERTIFICATE_LENGTH_SIGNED_WITH_HASH`

    - ### Fields inherited from class net.i2p.data.KeysAndCert

      `_certificate, _paddingBlocks, _publicKey, _signingKey`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VerifiedDestination()`
    `VerifiedDestination(Destination d)` create from an existing Dest
    `VerifiedDestination(String s)` alternative constructor which takes a base64 string representation

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `toString()`
    `boolean` | `verifyCert(boolean allowNone)` verify the certificate.
    `protected boolean` | `verifySignedCert()` Signed Certs are signed by a 3rd-party Destination.
    `protected boolean` | `verifyUnknownCert()` Reject all unknown certs

    - ### Methods inherited from class net.i2p.data.Destination

      `clearCache, create, equals, hashCode, size, toBase32, toBase64, writeBytes`

    - ### Methods inherited from class net.i2p.data.KeysAndCert

      `calculateHash, combinePadding, getCertificate, getEncType, getHash, getPadding, getPublicKey, getSigningPublicKey, getSigType, isCompressible, readBytes, setCertificate, setPadding, setPublicKey, setSigningPublicKey, writeBytes, writePaddingBytes`

    - ### Methods inherited from class net.i2p.data.DataStructureImpl

      `fromBase64, fromByteArray, read, toByteArray`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### 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

  - ### Constructor Detail

    - #### VerifiedDestination

          public VerifiedDestination()

    - #### VerifiedDestination

          public VerifiedDestination(Destination d)
                              throws DataFormatException

      create from an existing Dest
      Parameters:
        `d` - must be non-null
      Throws:
        `DataFormatException`

    - #### 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`

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `KeysAndCert`

    - #### verifyCert

          public boolean verifyCert(boolean allowNone)

      verify the certificate.
      Parameters:
        `allowNone` - If true, allow a NULL or HIDDEN certificate.

    - #### 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() for sample verification code.

    - #### verifyUnknownCert

          protected boolean verifyUnknownCert()

      Reject all unknown certs