Search in sources :

Example 1 with PublicKeyDownloadService

use of org.gradle.security.internal.PublicKeyDownloadService in project gradle by gradle.

the class DefaultSignatureVerificationServiceFactory method create.

@Override
public SignatureVerificationService create(BuildTreeDefinedKeys keyrings, List<URI> keyServers, boolean useKeyServers) {
    boolean refreshKeys = this.refreshKeys || !useKeyServers;
    ExternalResourceRepository repository = transportFactory.createTransport("https", "https", Collections.emptyList(), redirectLocations -> {
    }).getRepository();
    PublicKeyService keyService;
    if (useKeyServers) {
        PublicKeyDownloadService keyDownloadService = new PublicKeyDownloadService(ImmutableList.copyOf(keyServers), repository);
        keyService = new CrossBuildCachingKeyService(cacheRepository, decoratorFactory, buildOperationExecutor, keyDownloadService, timeProvider, refreshKeys);
    } else {
        keyService = EmptyPublicKeyService.getInstance();
    }
    keyService = keyrings.applyTo(keyService);
    File effectiveKeyringsFile = keyrings.getEffectiveKeyringsFile();
    HashCode keyringFileHash = effectiveKeyringsFile != null && effectiveKeyringsFile.exists() ? fileHasher.hash(effectiveKeyringsFile) : NO_KEYRING_FILE_HASH;
    DefaultSignatureVerificationService delegate = new DefaultSignatureVerificationService(keyService);
    return new CrossBuildSignatureVerificationService(delegate, fileHasher, buildScopedCache, decoratorFactory, timeProvider, refreshKeys, useKeyServers, keyringFileHash);
}
Also used : Hashing(org.gradle.internal.hash.Hashing) BuildCommencedTimeProvider(org.gradle.util.internal.BuildCommencedTimeProvider) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FileHasher(org.gradle.internal.hash.FileHasher) UncheckedException(org.gradle.internal.UncheckedException) ImmutableList(com.google.common.collect.ImmutableList) PublicKeyService(org.gradle.security.internal.PublicKeyService) BuildScopedCache(org.gradle.cache.scopes.BuildScopedCache) PGPPublicKeyRing(org.bouncycastle.openpgp.PGPPublicKeyRing) InMemoryCacheDecoratorFactory(org.gradle.cache.internal.InMemoryCacheDecoratorFactory) PublicKeyDownloadService(org.gradle.security.internal.PublicKeyDownloadService) URI(java.net.URI) Fingerprint(org.gradle.security.internal.Fingerprint) PGPException(org.bouncycastle.openpgp.PGPException) RepositoryTransportFactory(org.gradle.api.internal.artifacts.repositories.transport.RepositoryTransportFactory) Scopes(org.gradle.internal.service.scopes.Scopes) PGPSignatureList(org.bouncycastle.openpgp.PGPSignatureList) PublicKeyResultBuilder(org.gradle.security.internal.PublicKeyResultBuilder) SecuritySupport.toLongIdHexString(org.gradle.security.internal.SecuritySupport.toLongIdHexString) ExternalResourceRepository(org.gradle.internal.resource.ExternalResourceRepository) PGPSignature(org.bouncycastle.openpgp.PGPSignature) Set(java.util.Set) PGPPublicKey(org.bouncycastle.openpgp.PGPPublicKey) IOException(java.io.IOException) ServiceScope(org.gradle.internal.service.scopes.ServiceScope) HashCode(org.gradle.internal.hash.HashCode) File(java.io.File) UncheckedIOException(java.io.UncheckedIOException) List(java.util.List) BuildOperationExecutor(org.gradle.internal.operations.BuildOperationExecutor) SecuritySupport(org.gradle.security.internal.SecuritySupport) GlobalScopedCache(org.gradle.cache.scopes.GlobalScopedCache) EmptyPublicKeyService(org.gradle.security.internal.EmptyPublicKeyService) Collections(java.util.Collections) HashCode(org.gradle.internal.hash.HashCode) PublicKeyService(org.gradle.security.internal.PublicKeyService) EmptyPublicKeyService(org.gradle.security.internal.EmptyPublicKeyService) PublicKeyDownloadService(org.gradle.security.internal.PublicKeyDownloadService) File(java.io.File) ExternalResourceRepository(org.gradle.internal.resource.ExternalResourceRepository)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 File (java.io.File)1 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 URI (java.net.URI)1 Collections (java.util.Collections)1 List (java.util.List)1 Set (java.util.Set)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 PGPException (org.bouncycastle.openpgp.PGPException)1 PGPPublicKey (org.bouncycastle.openpgp.PGPPublicKey)1 PGPPublicKeyRing (org.bouncycastle.openpgp.PGPPublicKeyRing)1 PGPSignature (org.bouncycastle.openpgp.PGPSignature)1 PGPSignatureList (org.bouncycastle.openpgp.PGPSignatureList)1 RepositoryTransportFactory (org.gradle.api.internal.artifacts.repositories.transport.RepositoryTransportFactory)1 InMemoryCacheDecoratorFactory (org.gradle.cache.internal.InMemoryCacheDecoratorFactory)1 BuildScopedCache (org.gradle.cache.scopes.BuildScopedCache)1 GlobalScopedCache (org.gradle.cache.scopes.GlobalScopedCache)1 UncheckedException (org.gradle.internal.UncheckedException)1 FileHasher (org.gradle.internal.hash.FileHasher)1