Class OCSPCacheManagement
java.lang.Object
br.ufsc.labsec.utils.cache.Cache<RevocationResult<org.bouncycastle.cert.ocsp.OCSPResp>>
br.ufsc.labsec.signature.repository.PKCS12IdentityService.RevocationCache<org.bouncycastle.cert.ocsp.OCSPResp>
br.ufsc.labsec.signature.repository.PKCS12IdentityService.OCSPCacheManagement
- All Implemented Interfaces:
OcspRevocationCache, Iterable<CacheEntry<RevocationResult<org.bouncycastle.cert.ocsp.OCSPResp>>>
public class OCSPCacheManagement
extends RevocationCache<org.bouncycastle.cert.ocsp.OCSPResp>
implements OcspRevocationCache
A classe OCSPCacheManagement é responsável por cuidar do cachê das respostas OCSP.
Os arquivos de cache são armazenados no diretório especificado no construtor.
O nome do aquivo é o digest SHA-256 do certificado e o conteúdo é a resposta OCSP em Base64.
-
Nested Class Summary
Nested classes/interfaces inherited from class Cache
Cache.Source -
Field Summary
Fields inherited from class Cache
path, regexFilter, runtimeCache -
Constructor Summary
ConstructorsConstructorDescriptionOCSPCacheManagement(String cachePath) Construtor da classe OCSPCacheManagement. -
Method Summary
Modifier and TypeMethodDescriptionprotected RevocationResult<org.bouncycastle.cert.ocsp.OCSPResp> decodeEntry(byte[]... encodedParts) Decodifica um objeto em cache a partir de seus bytes em "chunks", habilitando armazenamento de um objeto em diversos arquivos, como assinaturas detached, por exemplo.protected Optional<RevocationResult<org.bouncycastle.cert.ocsp.OCSPResp>> download(SubjectIssuerPair certificatePair) Optional<RevocationResult<org.bouncycastle.cert.ocsp.OCSPResp>> getOCSPFromCertificate(Object certificate, Object issuer, Time timeReference) Buscas e retorna a resposta OCSP no cache.protected booleanVerifica se a resposta OCSP é útil.Methods inherited from class RevocationCache
downloadAndStore, getCacheKeyFromCert, getRevocation, isUsefulMethods inherited from class Cache
checkExpired, get, getLastAccess, getSource, groupFilesInDiskBy, has, has, iterator, remove, storeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface OcspRevocationCache
getOCSPFromCertificate
-
Constructor Details
-
OCSPCacheManagement
Construtor da classe OCSPCacheManagement. Cria o diretório de cache se ele não existir.- Parameters:
cachePath- caminho do diretório de cache.
-
-
Method Details
-
getOCSPFromCertificate
public Optional<RevocationResult<org.bouncycastle.cert.ocsp.OCSPResp>> getOCSPFromCertificate(Object certificate, Object issuer, Time timeReference) Buscas e retorna a resposta OCSP no cache. Se a resposta não estiver no cache, ela é baixada.- Specified by:
getOCSPFromCertificatein interfaceOcspRevocationCache- Parameters:
certificate- Certificado.issuer- Emissor.timeReference- Data de referência.- Returns:
- Resposta OCSP.
-
decodeEntry
protected RevocationResult<org.bouncycastle.cert.ocsp.OCSPResp> decodeEntry(byte[]... encodedParts) throws EncodingException Description copied from class:CacheDecodifica um objeto em cache a partir de seus bytes em "chunks", habilitando armazenamento de um objeto em diversos arquivos, como assinaturas detached, por exemplo.- Specified by:
decodeEntryin classCache<RevocationResult<org.bouncycastle.cert.ocsp.OCSPResp>>- Parameters:
encodedParts- Os bytes do objeto- Returns:
- O objeto decodificado
- Throws:
EncodingException- Exceção em caso de erro na decodificação
-
download
protected Optional<RevocationResult<org.bouncycastle.cert.ocsp.OCSPResp>> download(SubjectIssuerPair certificatePair) - Specified by:
downloadin classRevocationCache<org.bouncycastle.cert.ocsp.OCSPResp>
-
isUseful
Verifica se a resposta OCSP é útil.- Specified by:
isUsefulin classRevocationCache<org.bouncycastle.cert.ocsp.OCSPResp>- Parameters:
response- Resposta OCSP.timeReference- Data de referência.- Returns:
- true se a resposta é útil, false caso contrário. Uma resposta é útil se o certificado foi revogado e a data de revogação é anterior a data de referência, ou se a data de referência está entre a data de thisUpdate e nextUpdate e o certificado não foi revogado.
-