Interface CertificateParser.KeyHandler

  • All Superinterfaces:
    CertificateParser.ParserHandler
    Enclosing class:
    CertificateParser

    public static interface CertificateParser.KeyHandler
    extends CertificateParser.ParserHandler
    A KeyHandler is triggered by a CertificateParser and allows to fill the fields of a PublicKey pre-allocated by the application with the values of the public key of the certificate.

    This handler is only triggered when the certificate public key has a type and length supported by the CertificateParser and if it can be build using the KeyBuilder class. Note that the CertificateParser may only support a subset of types supported by the KeyBuilder class.

    This handler is a way for the application to provide to the CertificateParser a pre-allocated PublicKey object to be filled with the field values contained within the certificate. In some cases, the certificate does not contain all fields of the public key (e.g some ECC or DSA parameters are optional for X.509 certificates) and it is up to the application to fill in the missing fields to complete the initialization of the PublicKey object if necessary.

    When parsing the certificate public key field, the KeyHandler is triggered by the CertificateParser prior any other handlers implementing a ParserHandler. Hence, the application is aware if the public key can be extracted by the parser and can decide how other fields should be handled (for example keeping the encoded form of the public key).

    There are two places where KeyHandler can be used:

    Since:
    3.1
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      PublicKey onKey​(byte keytype, short param)
      Override this method to provide the relevant key object to be populated by the parser.