Class CryptoProvider

java.lang.Object
br.com.seedgrid.privacy.CryptoProvider

public final class CryptoProvider extends Object
  • Field Details

    • ENCRYPTION_ENABLED_PROPERTY

      public static final String ENCRYPTION_ENABLED_PROPERTY
      Propriedade que liga/desliga a criptografia at-rest dos @EncryptedField. Default: desligado.
      See Also:
  • Method Details

    • isEncryptionEnabled

      public static boolean isEncryptionEnabled()
      A criptografia at-rest esta ligada? Decide pela propriedade ENCRYPTION_ENABLED_PROPERTY (default false) — a menos que um override de teste tenha sido setado.

      Modo agnostico (default, desligado): os @EncryptedField gravam o valor cru no banco e o campo de hash de busca fica null; a busca se da pelo campo normal. A aplicacao consumidora NAO precisa configurar chave nenhuma.

      Modo cifrado (ligado): exige seedgrid.crypto.key e seedgrid.search.key configuradas — se faltar, o boot/persist falha (fail-closed: pega erro de config no deploy, em vez de gravar PII em claro silenciosamente).

    • looksEncrypted

      public static boolean looksEncrypted(String value)
      Um valor ja cifrado por esta lib? Checagem por prefixo de versao — NAO exige chave.
    • configure

      public static void configure(CryptoService cryptoService)
    • configureSearchHashService

      public static void configureSearchHashService(SearchHashService searchHashService)
    • configureNormalizer

      public static void configureNormalizer(ValueNormalizer normalizer)
    • getCryptoService

      public static CryptoService getCryptoService()
    • getSearchHashService

      public static SearchHashService getSearchHashService()
    • getNormalizer

      public static ValueNormalizer getNormalizer()
    • getSecureSearch

      public static EncryptedFieldSearch getSecureSearch()
    • setEncryptionEnabledForTests

      public static void setEncryptionEnabledForTests(boolean enabled)
      Liga/desliga a criptografia programaticamente (apenas testes). Sobrepoe a config.
    • resetForTests

      public static void resetForTests()
    • loadConfiguredProperties

      public static Optional<CryptoProperties> loadConfiguredProperties()