Search in sources :

Example 1 with DependencyVerifier

use of org.gradle.api.internal.artifacts.verification.verifier.DependencyVerifier in project gradle by gradle.

the class WriteDependencyVerificationFile method serializeResult.

private void serializeResult(SignatureVerificationService signatureVerificationService) throws IOException {
    File out = isDryRun ? dryRunVerificationFile() : verificationFile;
    if (generatePgpInfo) {
        verificationsBuilder.setVerifySignatures(true);
    }
    DependencyVerifier verifier = verificationsBuilder.build();
    DependencyVerificationsXmlWriter.serialize(verifier, new FileOutputStream(out));
    if (isExportKeyring) {
        exportKeys(signatureVerificationService, verifier);
    }
}
Also used : DependencyVerifier(org.gradle.api.internal.artifacts.verification.verifier.DependencyVerifier) FileOutputStream(java.io.FileOutputStream) File(java.io.File)

Example 2 with DependencyVerifier

use of org.gradle.api.internal.artifacts.verification.verifier.DependencyVerifier in project gradle by gradle.

the class WriteDependencyVerificationFile method exportKeys.

private void exportKeys(SignatureVerificationService signatureVerificationService, DependencyVerifier verifier) throws IOException {
    BuildTreeDefinedKeys keys = isDryRun ? keyrings.dryRun() : keyrings;
    Set<String> keysToExport = Sets.newHashSet();
    verifier.getConfiguration().getTrustedKeys().stream().map(DependencyVerificationConfiguration.TrustedKey::getKeyId).forEach(keysToExport::add);
    verifier.getConfiguration().getIgnoredKeys().stream().map(IgnoredKey::getKeyId).forEach(keysToExport::add);
    verifier.getVerificationMetadata().stream().flatMap(md -> md.getArtifactVerifications().stream()).flatMap(avm -> Stream.concat(avm.getTrustedPgpKeys().stream(), avm.getIgnoredPgpKeys().stream().map(IgnoredKey::getKeyId))).forEach(keysToExport::add);
    exportKeyRingCollection(signatureVerificationService.getPublicKeyService(), keys, keysToExport);
}
Also used : DependencyVerificationOverride(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.DependencyVerificationOverride) SignatureVerificationResultBuilder(org.gradle.api.internal.artifacts.verification.signatures.SignatureVerificationResultBuilder) ChecksumService(org.gradle.internal.hash.ChecksumService) UncheckedException(org.gradle.internal.UncheckedException) PublicKeyService(org.gradle.security.internal.PublicKeyService) ModuleComponentRepository(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleComponentRepository) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) DependencyVerificationException(org.gradle.api.internal.artifacts.verification.DependencyVerificationException) PGPPublicKeyRing(org.bouncycastle.openpgp.PGPPublicKeyRing) BigInteger(java.math.BigInteger) ChecksumKind(org.gradle.api.internal.artifacts.verification.model.ChecksumKind) ImmutableSet(com.google.common.collect.ImmutableSet) Project(org.gradle.api.Project) Files.getNameWithoutExtension(com.google.common.io.Files.getNameWithoutExtension) DependencyVerificationsXmlReader(org.gradle.api.internal.artifacts.verification.serializer.DependencyVerificationsXmlReader) SignatureVerificationServiceFactory(org.gradle.api.internal.artifacts.verification.signatures.SignatureVerificationServiceFactory) DependencyVerifier(org.gradle.api.internal.artifacts.verification.verifier.DependencyVerifier) Set(java.util.Set) PGPPublicKey(org.bouncycastle.openpgp.PGPPublicKey) IgnoredKey(org.gradle.api.internal.artifacts.verification.model.IgnoredKey) BuildOperationDescriptor(org.gradle.internal.operations.BuildOperationDescriptor) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Gradle(org.gradle.api.invocation.Gradle) FileNotFoundException(java.io.FileNotFoundException) StandardCharsets(java.nio.charset.StandardCharsets) ArtifactView(org.gradle.api.artifacts.ArtifactView) List(java.util.List) Stream(java.util.stream.Stream) BuildOperationExecutor(org.gradle.internal.operations.BuildOperationExecutor) DefaultKeyServers(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.DefaultKeyServers) Factory(org.gradle.internal.Factory) DeprecatableConfiguration(org.gradle.internal.deprecation.DeprecatableConfiguration) DependencyVerifyingModuleComponentRepository(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DependencyVerifyingModuleComponentRepository) DependencyVerificationConfiguration(org.gradle.api.internal.artifacts.verification.verifier.DependencyVerificationConfiguration) AtomicReference(java.util.concurrent.atomic.AtomicReference) UncheckedIOException(org.gradle.api.UncheckedIOException) Logger(org.gradle.api.logging.Logger) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) Configuration(org.gradle.api.artifacts.Configuration) ArtifactVerificationOperation(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.ArtifactVerificationOperation) RunnableBuildOperation(org.gradle.internal.operations.RunnableBuildOperation) ImmutableList(com.google.common.collect.ImmutableList) BuildTreeDefinedKeys(org.gradle.api.internal.artifacts.verification.signatures.BuildTreeDefinedKeys) DependencyVerificationsXmlWriter(org.gradle.api.internal.artifacts.verification.serializer.DependencyVerificationsXmlWriter) Fingerprint(org.gradle.security.internal.Fingerprint) OutputStream(java.io.OutputStream) PublicKeyResultBuilder(org.gradle.security.internal.PublicKeyResultBuilder) Action(org.gradle.api.Action) Iterator(java.util.Iterator) SignatureVerificationService(org.gradle.api.internal.artifacts.verification.signatures.SignatureVerificationService) DependencyVerifierBuilder(org.gradle.api.internal.artifacts.verification.verifier.DependencyVerifierBuilder) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) File(java.io.File) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) ArmoredOutputStream(org.bouncycastle.bcpg.ArmoredOutputStream) Logging(org.gradle.api.logging.Logging) SecuritySupport(org.gradle.security.internal.SecuritySupport) ModuleComponentArtifactIdentifier(org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier) BuildOperationContext(org.gradle.internal.operations.BuildOperationContext) PGPUtils(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.utils.PGPUtils) Collections(java.util.Collections) BuildTreeDefinedKeys(org.gradle.api.internal.artifacts.verification.signatures.BuildTreeDefinedKeys) DependencyVerificationConfiguration(org.gradle.api.internal.artifacts.verification.verifier.DependencyVerificationConfiguration)

Aggregations

File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Sets (com.google.common.collect.Sets)1 Files.getNameWithoutExtension (com.google.common.io.Files.getNameWithoutExtension)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 BigInteger (java.math.BigInteger)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Collections (java.util.Collections)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 ArmoredOutputStream (org.bouncycastle.bcpg.ArmoredOutputStream)1