Class KeyFormatPem

    • Field Detail

      • WITHOUT_CERTIFICATE

        public static final KeyFormatPem WITHOUT_CERTIFICATE
        Exports the key material without any associated certificate.
      • WITH_CERTIFICATE

        public static final KeyFormatPem WITH_CERTIFICATE
        Exports the key material with the certificate as well. The certificate will be exported before the key.
    • Constructor Detail

      • KeyFormatPem

        public KeyFormatPem​(boolean includeCertificate)
        Constructs a new PEM key format that does not encrypt private keys. This should only be used if either no private key material is being exported or it will never be exposed to untrusted sources.
        Parameters:
        includeCertificate - whether to include any certificate associated with the key in the PEM.
    • Method Detail

      • export

        public String export​(CryptoKey key,
                             Key rawKey)
        Description copied from interface: KeyFormat
        Exports the given crypto key and raw key material.
        Specified by:
        export in interface KeyFormat<String>
        Parameters:
        key - the crypto key.
        rawKey - the raw key material.
        Returns:
        the exported key material in the given format.