]> source.dussan.org Git - jgit.git/commitdiff
Decouple BouncyCastle from JGit Core 60/161560/17
authorMatthias Sohn <matthias.sohn@sap.com>
Sun, 26 Apr 2020 22:58:28 +0000 (00:58 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 31 May 2020 23:26:22 +0000 (01:26 +0200)
Motivation: BouncyCastle serves as 'default' implementation of
the GPG Signer. If a client application does not use it there is no need
to pull in this dependency, especially since BouncyCastle is a large
library.

Move the classes depending on BouncyCastle to an OSGi fragment extending
the org.eclipse.jgit bundle. They are moved to a distinct internal
package in order to avoid split packages. This doesn't break public API
since these classes were already in an internal package before this
change.

Add a new feature org.eclipse.jgit.gpg.bc to enable installation. With
that users can now decide if they want to install it.

Attempts to sign a commit if org.eclipse.jgit.gpg.bc isn't available
will result in ServiceUnavailableException being thrown.

Bug: 559106
Change-Id: I42fd6c00002e17aa9a7be96ae434b538ea86ccf8
Also-by: Michael Dardis <git@md-5.net>
Signed-off-by: Michael Dardis <git@md-5.net>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
80 files changed:
WORKSPACE
lib/BUILD
org.eclipse.jgit.gpg.bc.test/.classpath [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.gitignore [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.project [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.core.resources.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.core.runtime.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.jdt.ui.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.mylyn.tasks.ui.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.mylyn.team.ui.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.pde.api.tools.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.pde.core.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.pde.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/BUILD [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/META-INF/MANIFEST.MF [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/about.html [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/build.properties [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/plugin.properties [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/pom.xml [new file with mode: 0644]
org.eclipse.jgit.gpg.bc.test/tst/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKeyLocatorTest.java [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.classpath [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.fbprefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.gitignore [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.project [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.settings/org.eclipse.core.resources.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.settings/org.eclipse.core.runtime.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.settings/org.eclipse.jdt.ui.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.settings/org.eclipse.mylyn.tasks.ui.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.settings/org.eclipse.mylyn.team.ui.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.settings/org.eclipse.pde.api.tools.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/.settings/org.eclipse.pde.core.prefs [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/BUILD [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/META-INF/MANIFEST.MF [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/META-INF/SOURCE-MANIFEST.MF [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/about.html [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/build.properties [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/plugin.properties [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/pom.xml [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/resources/META-INF/services/org.eclipse.jgit.lib.GpgSigner [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/resources/org/eclipse/jgit/gpg/bc/internal/BCText.properties [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BCText.java [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKey.java [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKeyLocator.java [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKeyPassphrasePrompt.java [new file with mode: 0644]
org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgSigner.java [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.gitignore [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.project [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.core.runtime.prefs [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.m2e.core.prefs [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.mylyn.tasks.ui.prefs [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.mylyn.team.ui.prefs [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/build.properties [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/edl-v10.html [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/feature.properties [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/feature.xml [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/license.html [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/pom.xml [new file with mode: 0644]
org.eclipse.jgit.packaging/org.eclipse.jgit.repository/category.xml
org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml
org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml
org.eclipse.jgit.packaging/pom.xml
org.eclipse.jgit.pgm/BUILD
org.eclipse.jgit.pgm/pom.xml
org.eclipse.jgit.test/BUILD
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocatorTest.java [deleted file]
org.eclipse.jgit/BUILD
org.eclipse.jgit/META-INF/MANIFEST.MF
org.eclipse.jgit/pom.xml
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ServiceUnavailableException.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/GpgSigner.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKey.java [deleted file]
org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java [deleted file]
org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyPassphrasePrompt.java [deleted file]
org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.java [deleted file]
pom.xml

index 64218b590ec65614e0ed5c0fdd0732b23365d1ea..509cf6d0944c6f3ddbb6139e30e9b6fe28a0248c 100644 (file)
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -264,9 +264,9 @@ maven_jar(
 
 maven_jar(
     name = "bcprov",
-    artifact = "org.bouncycastle:bcprov-jdk15on:" + BOUNCYCASTLE_VER,
-    sha1 = "320b989112f00a63a3bcfa5a98f31a4f865a20fa",
-    src_sha1 = "ef2676604015c183bb29f8e17846cb3aa4b80c24",
+    artifact = "org.bouncycastle:bcprov-jdk15on:1.65.01",
+    sha1 = "0fbd478ea7b07acc3902b9585a37fd88393f8427",
+    src_sha1 = "8f54635075628c69b6c037e800dd0b03ffb8dd51",
 )
 
 maven_jar(
index 6c974865ecea02ebac3f8428e645baa8f303ef7e..a6864fa36bee7fadcf9fcbbcb3b79f11c2b7f95a 100644 (file)
--- a/lib/BUILD
+++ b/lib/BUILD
@@ -154,6 +154,7 @@ java_library(
     name = "bcpg",
     visibility = [
         "//org.eclipse.jgit:__pkg__",
+        "//org.eclipse.jgit.gpg.bc:__pkg__",
         "//org.eclipse.jgit.test:__pkg__",
     ],
     exports = ["@bcpg//jar"],
@@ -163,6 +164,7 @@ java_library(
     name = "bcprov",
     visibility = [
         "//org.eclipse.jgit:__pkg__",
+        "//org.eclipse.jgit.gpg.bc:__pkg__",
         "//org.eclipse.jgit.test:__pkg__",
     ],
     exports = ["@bcprov//jar"],
@@ -172,6 +174,7 @@ java_library(
     name = "bcpkix",
     visibility = [
         "//org.eclipse.jgit:__pkg__",
+        "//org.eclipse.jgit.gpg.bc:__pkg__",
         "//org.eclipse.jgit.test:__pkg__",
     ],
     exports = ["@bcpkix//jar"],
diff --git a/org.eclipse.jgit.gpg.bc.test/.classpath b/org.eclipse.jgit.gpg.bc.test/.classpath
new file mode 100644 (file)
index 0000000..f08af0a
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="tst">
+               <attributes>
+                       <attribute name="test" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.jgit.gpg.bc.test/.gitignore b/org.eclipse.jgit.gpg.bc.test/.gitignore
new file mode 100644 (file)
index 0000000..934e0e0
--- /dev/null
@@ -0,0 +1,2 @@
+/bin
+/target
diff --git a/org.eclipse.jgit.gpg.bc.test/.project b/org.eclipse.jgit.gpg.bc.test/.project
new file mode 100644 (file)
index 0000000..9aac4a2
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.eclipse.jgit.gpg.bc.test</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.core.resources.prefs b/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.core.resources.prefs
new file mode 100644 (file)
index 0000000..99f26c0
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.core.runtime.prefs
new file mode 100644 (file)
index 0000000..5a0ad22
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..822846c
--- /dev/null
@@ -0,0 +1,399 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=1
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=true
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644 (file)
index 0000000..fef3713
--- /dev/null
@@ -0,0 +1,66 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_JGit Format
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.mylyn.tasks.ui.prefs b/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.mylyn.tasks.ui.prefs
new file mode 100644 (file)
index 0000000..3dec4d9
--- /dev/null
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+project.repository.kind=bugzilla
+project.repository.url=https\://bugs.eclipse.org/bugs
diff --git a/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.mylyn.team.ui.prefs
new file mode 100644 (file)
index 0000000..ce7a0f0
--- /dev/null
@@ -0,0 +1,2 @@
+commit.comment.template=${task.description} \n\nBug\: ${task.key}
+eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644 (file)
index 0000000..c0030de
--- /dev/null
@@ -0,0 +1,104 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_FIELD=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_ANNOTATION=Ignore
+INVALID_JAVADOC_TAG=Ignore
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Warning
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+changed_execution_env=Error
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+incompatible_api_component_version_report_major_without_breaking_change=Warning
+incompatible_api_component_version_report_minor_without_api_change=Ignore
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.pde.core.prefs b/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.pde.core.prefs
new file mode 100644 (file)
index 0000000..923c37f
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+resolve.requirebundle=false
diff --git a/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.pde.prefs b/org.eclipse.jgit.gpg.bc.test/.settings/org.eclipse.pde.prefs
new file mode 100644 (file)
index 0000000..2174e4f
--- /dev/null
@@ -0,0 +1,34 @@
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.no.automatic.module=1
+compilers.p.not-externalized-att=2
+compilers.p.service.component.without.lazyactivation=1
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.gpg.bc.test/BUILD b/org.eclipse.jgit.gpg.bc.test/BUILD
new file mode 100644 (file)
index 0000000..1e3677d
--- /dev/null
@@ -0,0 +1,14 @@
+load(
+    "@com_googlesource_gerrit_bazlets//tools:junit.bzl",
+    "junit_tests",
+)
+
+junit_tests(
+    name = "bc",
+    srcs = glob(["tst/**/*.java"]),
+    tags = ["bc"],
+    deps = [
+        "//lib:junit",
+        "//org.eclipse.jgit.gpg.bc:gpg-bc",
+    ],
+)
diff --git a/org.eclipse.jgit.gpg.bc.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.gpg.bc.test/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..3eb0e04
--- /dev/null
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Automatic-Module-Name: org.eclipse.jgit.gpg.bc.test
+Bundle-SymbolicName: org.eclipse.jgit.gpg.bc.test
+Bundle-Version: 5.8.0.qualifier
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: org.eclipse.jgit.gpg.bc.internal;version="[5.8.0,5.9.0)",
+ org.junit;version="[4.13,5.0.0)"
+Export-Package: org.eclipse.jgit.gpg.bc.internal;x-internal:=true
+Require-Bundle: org.hamcrest.core;bundle-version="[1.1.0,2.0.0)",
+ org.hamcrest.library;bundle-version="[1.1.0,2.0.0)"
diff --git a/org.eclipse.jgit.gpg.bc.test/about.html b/org.eclipse.jgit.gpg.bc.test/about.html
new file mode 100644 (file)
index 0000000..f971af1
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Distribution License - Version 1.0</title>
+<style type="text/css">
+  body {
+    size: 8.5in 11.0in;
+    margin: 0.25in 0.5in 0.25in 0.5in;
+    tab-interval: 0.5in;
+    }
+  p {          
+    margin-left: auto;
+    margin-top:  0.5em;
+    margin-bottom: 0.5em;
+    }
+  p.list {
+       margin-left: 0.5in;
+    margin-top:  0.05em;
+    margin-bottom: 0.05em;
+    }
+  .ubc-name {
+    margin-left: 0.5in;
+    white-space: pre;
+  }
+  </style>
+
+</head>
+
+<body lang="EN-US">
+
+<p><b>Eclipse Distribution License - v 1.0</b></p>
+
+<p>Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. </p>
+
+<p>All rights reserved.</p>
+<p>Redistribution and use in source and binary forms, with or without modification, 
+       are permitted provided that the following conditions are met:
+<ul><li>Redistributions of source code must retain the above copyright notice, 
+       this list of conditions and the following disclaimer. </li>
+<li>Redistributions in binary form must reproduce the above copyright notice, 
+       this list of conditions and the following disclaimer in the documentation 
+       and/or other materials provided with the distribution. </li>
+<li>Neither the name of the Eclipse Foundation, Inc. nor the names of its 
+       contributors may be used to endorse or promote products derived from 
+       this software without specific prior written permission. </li></ul>
+</p>
+<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+POSSIBILITY OF SUCH DAMAGE.</p>
+
+<hr>
+<p><b>SHA-1 UbcCheck - MIT</b></p>
+
+<p>Copyright (c) 2017:</p>
+<div class="ubc-name">
+Marc Stevens
+Cryptology Group
+Centrum Wiskunde & Informatica
+P.O. Box 94079, 1090 GB Amsterdam, Netherlands
+marc@marc-stevens.nl
+</div>
+<div class="ubc-name">
+Dan Shumow
+Microsoft Research
+danshu@microsoft.com
+</div>
+<p>Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+</p>
+<ul><li>The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.</li></ul>
+<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.</p>
+
+</body>
+
+</html>
diff --git a/org.eclipse.jgit.gpg.bc.test/build.properties b/org.eclipse.jgit.gpg.bc.test/build.properties
new file mode 100644 (file)
index 0000000..9ffa0ca
--- /dev/null
@@ -0,0 +1,5 @@
+source.. = tst/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.properties
diff --git a/org.eclipse.jgit.gpg.bc.test/plugin.properties b/org.eclipse.jgit.gpg.bc.test/plugin.properties
new file mode 100644 (file)
index 0000000..4377662
--- /dev/null
@@ -0,0 +1,2 @@
+Bundle-Name=JGit Tests for GPG with bouncycastle
+Bundle-Vendor=Eclipse JGit
diff --git a/org.eclipse.jgit.gpg.bc.test/pom.xml b/org.eclipse.jgit.gpg.bc.test/pom.xml
new file mode 100644 (file)
index 0000000..05c496b
--- /dev/null
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright (C) 2018, Thomas Wolf <thomas.wolf@paranor.ch> and others
+
+  This program and the accompanying materials are made available under the
+  terms of the Eclipse Distribution License v. 1.0 which is available at
+  http://www.eclipse.org/org/documents/edl-v10.php.
+
+  SPDX-License-Identifier: BSD-3-Clause
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.eclipse.jgit</groupId>
+    <artifactId>org.eclipse.jgit-parent</artifactId>
+    <version>5.8.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>org.eclipse.jgit.gpg.bc.test</artifactId>
+  <name>JGit - BouncyCastle GPG Tests</name>
+
+  <description>
+    JUnit tests for the JGit GPG support based on BouncyCastle.
+  </description>
+
+  <properties>
+    <maven.javadoc.skip>true</maven.javadoc.skip>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit.junit</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit.gpg.bc</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit.test</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+  </dependencies>
+
+  <profiles>
+    <!-- Profile provides a property which enables long running tests. -->
+    <profile>
+      <id>test.long</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <argLine>@{argLine} -Djgit.test.long=true</argLine>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+  <build>
+    <sourceDirectory>src/</sourceDirectory>
+    <testSourceDirectory>tst/</testSourceDirectory>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <argLine>@{argLine} -Xmx1024m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory}</argLine>
+          <includes>
+            <include>**/*Test.java</include>
+            <include>**/*Tests.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/org.eclipse.jgit.gpg.bc.test/tst/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKeyLocatorTest.java b/org.eclipse.jgit.gpg.bc.test/tst/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKeyLocatorTest.java
new file mode 100644 (file)
index 0000000..7446201
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2019, Thomas Wolf <thomas.wolf@paranor.ch> and others
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.gpg.bc.internal;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Locale;
+
+import org.junit.Test;
+
+public class BouncyCastleGpgKeyLocatorTest {
+
+       private static final String USER_ID = "Heinrich Heine <heinrichh@uni-duesseldorf.de>";
+
+       private static boolean match(String userId, String pattern) {
+               return BouncyCastleGpgKeyLocator.containsSigningKey(userId, pattern);
+       }
+
+       @Test
+       public void testFullMatch() throws Exception {
+               assertTrue(match(USER_ID,
+                               "=Heinrich Heine <heinrichh@uni-duesseldorf.de>"));
+               assertFalse(match(USER_ID, "=Heinrich Heine"));
+               assertFalse(match(USER_ID, "= "));
+               assertFalse(match(USER_ID, "=heinrichh@uni-duesseldorf.de"));
+       }
+
+       @Test
+       public void testEmpty() throws Exception {
+               assertFalse(match(USER_ID, ""));
+               assertFalse(match(USER_ID, null));
+               assertFalse(match("", ""));
+               assertFalse(match(null, ""));
+               assertFalse(match(null, null));
+               assertFalse(match("", "something"));
+               assertFalse(match(null, "something"));
+       }
+
+       @Test
+       public void testFullEmail() throws Exception {
+               assertTrue(match(USER_ID, "<heinrichh@uni-duesseldorf.de>"));
+               assertTrue(match(USER_ID + " ", "<heinrichh@uni-duesseldorf.de>"));
+               assertFalse(match(USER_ID, "<>"));
+               assertFalse(match(USER_ID, "<h>"));
+               assertFalse(match(USER_ID, "<heinrichh>"));
+               assertFalse(match(USER_ID, "<uni-duesseldorf>"));
+               assertFalse(match(USER_ID, "<h@u>"));
+               assertFalse(match(USER_ID, "<HeinrichH@uni-duesseldorf.de>"));
+               assertFalse(match(USER_ID.substring(0, USER_ID.length() - 1),
+                               "<heinrichh@uni-duesseldorf.de>"));
+               assertFalse(match("", "<>"));
+               assertFalse(match("", "<heinrichh@uni-duesseldorf.de>"));
+       }
+
+       @Test
+       public void testPartialEmail() throws Exception {
+               assertTrue(match(USER_ID, "@heinrichh@uni-duesseldorf.de"));
+               assertTrue(match(USER_ID, "@heinrichh"));
+               assertTrue(match(USER_ID, "@duesseldorf"));
+               assertTrue(match(USER_ID, "@uni-d"));
+               assertTrue(match(USER_ID, "@h"));
+               assertTrue(match(USER_ID, "@."));
+               assertTrue(match(USER_ID, "@h@u"));
+               assertFalse(match(USER_ID, "@ "));
+               assertFalse(match(USER_ID, "@"));
+               assertFalse(match(USER_ID, "@Heine"));
+               assertFalse(match(USER_ID, "@HeinrichH"));
+               assertFalse(match(USER_ID, "@Heinrich"));
+               assertFalse(match("", "@"));
+               assertFalse(match("", "@h"));
+       }
+
+       private void substringTests(String prefix) throws Exception {
+               assertTrue(match(USER_ID, prefix + "heinrichh@uni-duesseldorf.de"));
+               assertTrue(match(USER_ID, prefix + "heinrich"));
+               assertTrue(match(USER_ID, prefix + "HEIN"));
+               assertTrue(match(USER_ID, prefix + "Heine <"));
+               assertTrue(match(USER_ID, prefix + "UNI"));
+               assertTrue(match(USER_ID, prefix + "uni"));
+               assertTrue(match(USER_ID, prefix + "rich He"));
+               assertTrue(match(USER_ID, prefix + "h@u"));
+               assertTrue(match(USER_ID, prefix + USER_ID));
+               assertTrue(match(USER_ID, prefix + USER_ID.toUpperCase(Locale.ROOT)));
+               assertFalse(match(USER_ID, prefix + ""));
+               assertFalse(match(USER_ID, prefix + " "));
+               assertFalse(match(USER_ID, prefix + "yy"));
+               assertFalse(match("", prefix + ""));
+               assertFalse(match("", prefix + "uni"));
+       }
+
+       @Test
+       public void testSubstringPlain() throws Exception {
+               substringTests("");
+       }
+
+       @Test
+       public void testSubstringAsterisk() throws Exception {
+               substringTests("*");
+       }
+
+       @Test
+       public void testExplicitFingerprint() throws Exception {
+               assertFalse(match("John Fade <j.fade@example.com>", "0xfade"));
+               assertFalse(match("John Fade <0xfade@example.com>", "0xfade"));
+               assertFalse(match("", "0xfade"));
+       }
+
+       @Test
+       public void testImplicitFingerprint() throws Exception {
+               assertTrue(match("John Fade <j.fade@example.com>", "fade"));
+               assertTrue(match("John Fade <0xfade@example.com>", "fade"));
+               assertTrue(match("John Fade <j.fade@example.com>", "FADE"));
+               assertTrue(match("John Fade <0xfade@example.com>", "FADE"));
+       }
+
+       @Test
+       public void testZeroX() throws Exception {
+               assertTrue(match("John Fade <0xfade@example.com>", "0x"));
+               assertTrue(match("John Fade <0xfade@example.com>", "*0x"));
+               assertTrue(match("John Fade <0xfade@example.com>", "*0xfade"));
+               assertTrue(match("John Fade <0xfade@example.com>", "*0xFADE"));
+               assertTrue(match("John Fade <0xfade@example.com>", "@0xfade"));
+               assertFalse(match("John Fade <0xfade@example.com>", "@0xFADE"));
+               assertFalse(match("", "0x"));
+       }
+}
diff --git a/org.eclipse.jgit.gpg.bc/.classpath b/org.eclipse.jgit.gpg.bc/.classpath
new file mode 100644 (file)
index 0000000..110168f
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="resources"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.jgit.gpg.bc/.fbprefs b/org.eclipse.jgit.gpg.bc/.fbprefs
new file mode 100644 (file)
index 0000000..0a87ea2
--- /dev/null
@@ -0,0 +1,124 @@
+#FindBugs User Preferences
+detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
+detectorBadAppletConstructor=BadAppletConstructor|false
+detectorBadResultSetAccess=BadResultSetAccess|true
+detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true
+detectorBadUseOfReturnValue=BadUseOfReturnValue|true
+detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true
+detectorBooleanReturnNull=BooleanReturnNull|true
+detectorCallToUnsupportedMethod=CallToUnsupportedMethod|true
+detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true
+detectorCheckTypeQualifiers=CheckTypeQualifiers|true
+detectorCloneIdiom=CloneIdiom|false
+detectorComparatorIdiom=ComparatorIdiom|true
+detectorConfusedInheritance=ConfusedInheritance|true
+detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true
+detectorCrossSiteScripting=CrossSiteScripting|true
+detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true
+detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true
+detectorDontUseEnum=DontUseEnum|true
+detectorDroppedException=DroppedException|true
+detectorDumbMethodInvocations=DumbMethodInvocations|true
+detectorDumbMethods=DumbMethods|true
+detectorDuplicateBranches=DuplicateBranches|true
+detectorEmptyZipFileEntry=EmptyZipFileEntry|true
+detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true
+detectorFinalizerNullsFields=FinalizerNullsFields|true
+detectorFindBadCast2=FindBadCast2|true
+detectorFindBadForLoop=FindBadForLoop|true
+detectorFindCircularDependencies=FindCircularDependencies|false
+detectorFindDeadLocalStores=FindDeadLocalStores|true
+detectorFindDoubleCheck=FindDoubleCheck|true
+detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true
+detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true
+detectorFindFinalizeInvocations=FindFinalizeInvocations|true
+detectorFindFloatEquality=FindFloatEquality|true
+detectorFindHEmismatch=FindHEmismatch|true
+detectorFindInconsistentSync2=FindInconsistentSync2|true
+detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true
+detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true
+detectorFindMaskedFields=FindMaskedFields|true
+detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true
+detectorFindNakedNotify=FindNakedNotify|true
+detectorFindNonSerializableStoreIntoSession=FindNonSerializableStoreIntoSession|true
+detectorFindNonSerializableValuePassedToWriteObject=FindNonSerializableValuePassedToWriteObject|true
+detectorFindNonShortCircuit=FindNonShortCircuit|true
+detectorFindNullDeref=FindNullDeref|true
+detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true
+detectorFindOpenStream=FindOpenStream|true
+detectorFindPuzzlers=FindPuzzlers|true
+detectorFindRefComparison=FindRefComparison|true
+detectorFindReturnRef=FindReturnRef|true
+detectorFindRunInvocations=FindRunInvocations|true
+detectorFindSelfComparison=FindSelfComparison|true
+detectorFindSelfComparison2=FindSelfComparison2|true
+detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true
+detectorFindSpinLoop=FindSpinLoop|true
+detectorFindSqlInjection=FindSqlInjection|true
+detectorFindTwoLockWait=FindTwoLockWait|true
+detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true
+detectorFindUnconditionalWait=FindUnconditionalWait|true
+detectorFindUninitializedGet=FindUninitializedGet|true
+detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true
+detectorFindUnreleasedLock=FindUnreleasedLock|true
+detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true
+detectorFindUnsyncGet=FindUnsyncGet|true
+detectorFindUselessControlFlow=FindUselessControlFlow|true
+detectorFormatStringChecker=FormatStringChecker|true
+detectorHugeSharedStringConstants=HugeSharedStringConstants|true
+detectorIDivResultCastToDouble=IDivResultCastToDouble|true
+detectorIncompatMask=IncompatMask|true
+detectorInconsistentAnnotations=InconsistentAnnotations|true
+detectorInefficientMemberAccess=InefficientMemberAccess|false
+detectorInefficientToArray=InefficientToArray|true
+detectorInfiniteLoop=InfiniteLoop|true
+detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true
+detectorInfiniteRecursiveLoop2=InfiniteRecursiveLoop2|false
+detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true
+detectorInitializationChain=InitializationChain|true
+detectorInstantiateStaticClass=InstantiateStaticClass|true
+detectorInvalidJUnitTest=InvalidJUnitTest|true
+detectorIteratorIdioms=IteratorIdioms|true
+detectorLazyInit=LazyInit|true
+detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
+detectorMethodReturnCheck=MethodReturnCheck|true
+detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
+detectorMutableLock=MutableLock|true
+detectorMutableStaticFields=MutableStaticFields|true
+detectorNaming=Naming|true
+detectorNumberConstructor=NumberConstructor|true
+detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true
+detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
+detectorPublicSemaphores=PublicSemaphores|false
+detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
+detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
+detectorRedundantInterfaces=RedundantInterfaces|true
+detectorRepeatedConditionals=RepeatedConditionals|true
+detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true
+detectorSerializableIdiom=SerializableIdiom|true
+detectorStartInConstructor=StartInConstructor|true
+detectorStaticCalendarDetector=StaticCalendarDetector|true
+detectorStringConcatenation=StringConcatenation|true
+detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true
+detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true
+detectorSwitchFallthrough=SwitchFallthrough|true
+detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true
+detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true
+detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true
+detectorURLProblems=URLProblems|true
+detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true
+detectorUnnecessaryMath=UnnecessaryMath|true
+detectorUnreadFields=UnreadFields|true
+detectorUseObjectEquals=UseObjectEquals|false
+detectorUselessSubclassMethod=UselessSubclassMethod|false
+detectorVarArgsProblems=VarArgsProblems|true
+detectorVolatileUsage=VolatileUsage|true
+detectorWaitInLoop=WaitInLoop|true
+detectorWrongMapIterator=WrongMapIterator|true
+detectorXMLFactoryBypass=XMLFactoryBypass|true
+detector_threshold=2
+effort=default
+excludefilter0=findBugs/FindBugsExcludeFilter.xml
+filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,MT_CORRECTNESS,PERFORMANCE,STYLE|false
+filter_settings_neg=MALICIOUS_CODE,NOISE,I18N,SECURITY,EXPERIMENTAL|
+run_at_full_build=true
diff --git a/org.eclipse.jgit.gpg.bc/.gitignore b/org.eclipse.jgit.gpg.bc/.gitignore
new file mode 100644 (file)
index 0000000..934e0e0
--- /dev/null
@@ -0,0 +1,2 @@
+/bin
+/target
diff --git a/org.eclipse.jgit.gpg.bc/.project b/org.eclipse.jgit.gpg.bc/.project
new file mode 100644 (file)
index 0000000..86910cf
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.eclipse.jgit.gpg.bc</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.core.resources.prefs b/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.core.resources.prefs
new file mode 100644 (file)
index 0000000..99f26c0
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.core.runtime.prefs
new file mode 100644 (file)
index 0000000..5a0ad22
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..15ef2aa
--- /dev/null
@@ -0,0 +1,399 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jgit.annotations.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jgit.annotations.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jgit.annotations.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=1
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=true
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644 (file)
index 0000000..fef3713
--- /dev/null
@@ -0,0 +1,66 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_JGit Format
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.mylyn.tasks.ui.prefs b/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.mylyn.tasks.ui.prefs
new file mode 100644 (file)
index 0000000..3dec4d9
--- /dev/null
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+project.repository.kind=bugzilla
+project.repository.url=https\://bugs.eclipse.org/bugs
diff --git a/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.mylyn.team.ui.prefs
new file mode 100644 (file)
index 0000000..ce7a0f0
--- /dev/null
@@ -0,0 +1,2 @@
+commit.comment.template=${task.description} \n\nBug\: ${task.key}
+eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644 (file)
index 0000000..c0030de
--- /dev/null
@@ -0,0 +1,104 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_FIELD=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_ANNOTATION=Ignore
+INVALID_JAVADOC_TAG=Ignore
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Warning
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+changed_execution_env=Error
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+incompatible_api_component_version_report_major_without_breaking_change=Warning
+incompatible_api_component_version_report_minor_without_api_change=Ignore
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.pde.core.prefs b/org.eclipse.jgit.gpg.bc/.settings/org.eclipse.pde.core.prefs
new file mode 100644 (file)
index 0000000..923c37f
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+resolve.requirebundle=false
diff --git a/org.eclipse.jgit.gpg.bc/BUILD b/org.eclipse.jgit.gpg.bc/BUILD
new file mode 100644 (file)
index 0000000..4fe1e47
--- /dev/null
@@ -0,0 +1,21 @@
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(default_visibility = ["//visibility:public"])
+
+SRCS = glob(["src/**/*.java"])
+
+RESOURCES = glob(["resources/**"])
+
+java_library(
+    name = "gpg-bc",
+    srcs = SRCS,
+    resource_strip_prefix = "org.eclipse.jgit.gpg.bc/resources",
+    resources = RESOURCES,
+    deps = [
+        "//lib:bcpg",
+        "//lib:bcpkix",
+        "//lib:bcprov",
+        "//lib:slf4j-api",
+        "//org.eclipse.jgit:jgit",
+    ],
+)
diff --git a/org.eclipse.jgit.gpg.bc/META-INF/MANIFEST.MF b/org.eclipse.jgit.gpg.bc/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..574bbcf
--- /dev/null
@@ -0,0 +1,30 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Automatic-Module-Name: org.eclipse.jgit.gpg.bc
+Bundle-SymbolicName: org.eclipse.jgit.gpg.bc;singleton:=true
+Fragment-Host: org.eclipse.jgit;bundle-version="5.8.0.qualifier"
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Localization: plugin
+Bundle-Version: 5.8.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: org.assertj.core.annotations;version="3.14.0",
+ org.bouncycastle.bcpg;version="[1.65.0,2.0.0)",
+ org.bouncycastle.gpg;version="[1.65.0,2.0.0)",
+ org.bouncycastle.gpg.keybox;version="[1.65.0,2.0.0)",
+ org.bouncycastle.gpg.keybox.jcajce;version="[1.65.0,2.0.0)",
+ org.bouncycastle.jce.provider;version="[1.65.0,2.0.0)",
+ org.bouncycastle.openpgp;version="[1.65.0,2.0.0)",
+ org.bouncycastle.openpgp.operator;version="[1.65.0,2.0.0)",
+ org.bouncycastle.openpgp.operator.jcajce;version="[1.65.0,2.0.0)",
+ org.bouncycastle.util.encoders;version="[1.65.0,2.0.0)",
+ org.eclipse.jgit.annotations;version="[5.8.0,5.9.0)",
+ org.eclipse.jgit.api.errors;version="[5.8.0,5.9.0)",
+ org.eclipse.jgit.errors;version="[5.8.0,5.9.0)",
+ org.eclipse.jgit.lib;version="[5.8.0,5.9.0)",
+ org.eclipse.jgit.nls;version="[5.8.0,5.9.0)",
+ org.eclipse.jgit.transport;version="[5.8.0,5.9.0)",
+ org.eclipse.jgit.util;version="[5.8.0,5.9.0)",
+ org.slf4j;version="[1.7.0,2.0.0)"
+Export-Package: org.eclipse.jgit.gpg.bc.internal;version="5.8.0";
+  x-friends:="org.eclipse.jgit.gpg.bc.test"
diff --git a/org.eclipse.jgit.gpg.bc/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.gpg.bc/META-INF/SOURCE-MANIFEST.MF
new file mode 100644 (file)
index 0000000..49081f8
--- /dev/null
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.jgit.gpg.bc - Sources
+Bundle-SymbolicName: org.eclipse.jgit.gpg.bc.source
+Bundle-Vendor: Eclipse.org - JGit
+Bundle-Version: 5.8.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.gpg.bc;version="5.8.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.gpg.bc/about.html b/org.eclipse.jgit.gpg.bc/about.html
new file mode 100644 (file)
index 0000000..f971af1
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Distribution License - Version 1.0</title>
+<style type="text/css">
+  body {
+    size: 8.5in 11.0in;
+    margin: 0.25in 0.5in 0.25in 0.5in;
+    tab-interval: 0.5in;
+    }
+  p {          
+    margin-left: auto;
+    margin-top:  0.5em;
+    margin-bottom: 0.5em;
+    }
+  p.list {
+       margin-left: 0.5in;
+    margin-top:  0.05em;
+    margin-bottom: 0.05em;
+    }
+  .ubc-name {
+    margin-left: 0.5in;
+    white-space: pre;
+  }
+  </style>
+
+</head>
+
+<body lang="EN-US">
+
+<p><b>Eclipse Distribution License - v 1.0</b></p>
+
+<p>Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. </p>
+
+<p>All rights reserved.</p>
+<p>Redistribution and use in source and binary forms, with or without modification, 
+       are permitted provided that the following conditions are met:
+<ul><li>Redistributions of source code must retain the above copyright notice, 
+       this list of conditions and the following disclaimer. </li>
+<li>Redistributions in binary form must reproduce the above copyright notice, 
+       this list of conditions and the following disclaimer in the documentation 
+       and/or other materials provided with the distribution. </li>
+<li>Neither the name of the Eclipse Foundation, Inc. nor the names of its 
+       contributors may be used to endorse or promote products derived from 
+       this software without specific prior written permission. </li></ul>
+</p>
+<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+POSSIBILITY OF SUCH DAMAGE.</p>
+
+<hr>
+<p><b>SHA-1 UbcCheck - MIT</b></p>
+
+<p>Copyright (c) 2017:</p>
+<div class="ubc-name">
+Marc Stevens
+Cryptology Group
+Centrum Wiskunde & Informatica
+P.O. Box 94079, 1090 GB Amsterdam, Netherlands
+marc@marc-stevens.nl
+</div>
+<div class="ubc-name">
+Dan Shumow
+Microsoft Research
+danshu@microsoft.com
+</div>
+<p>Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+</p>
+<ul><li>The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.</li></ul>
+<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.</p>
+
+</body>
+
+</html>
diff --git a/org.eclipse.jgit.gpg.bc/build.properties b/org.eclipse.jgit.gpg.bc/build.properties
new file mode 100644 (file)
index 0000000..8148271
--- /dev/null
@@ -0,0 +1,7 @@
+source.. = src/,\
+           resources/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.properties,\
+               about.html
diff --git a/org.eclipse.jgit.gpg.bc/plugin.properties b/org.eclipse.jgit.gpg.bc/plugin.properties
new file mode 100644 (file)
index 0000000..b091492
--- /dev/null
@@ -0,0 +1,2 @@
+Bundle-Name=JGit GPG support based on bouncycastle
+Bundle-Vendor=Eclipse JGit
diff --git a/org.eclipse.jgit.gpg.bc/pom.xml b/org.eclipse.jgit.gpg.bc/pom.xml
new file mode 100644 (file)
index 0000000..ab0bc2e
--- /dev/null
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright (C) 2020, Matthias Sohn <matthias.sohn@sap.com> and others
+
+  This program and the accompanying materials are made available under the
+  terms of the Eclipse Distribution License v. 1.0 which is available at
+  http://www.eclipse.org/org/documents/edl-v10.php.
+
+  SPDX-License-Identifier: BSD-3-Clause
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.eclipse.jgit</groupId>
+    <artifactId>org.eclipse.jgit-parent</artifactId>
+    <version>5.8.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>org.eclipse.jgit.gpg.bc</artifactId>
+  <name>JGit - BouncyCastle-based GPG support</name>
+
+  <description>
+    GPG support for JGit based on BouncyCastle
+  </description>
+
+  <properties>
+    <translate-qualifier/>
+    <source-bundle-manifest>${project.build.directory}/META-INF/SOURCE-MANIFEST.MF</source-bundle-manifest>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcpg-jdk15on</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcprov-jdk15on</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcpkix-jdk15on</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <sourceDirectory>src/</sourceDirectory>
+
+    <resources>
+      <resource>
+        <directory>.</directory>
+        <includes>
+          <include>plugin.properties</include>
+          <include>about.html</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>resources/</directory>
+      </resource>
+    </resources>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>translate-source-qualifier</id>
+            <phase>generate-resources</phase>
+            <configuration>
+              <target>
+                <copy file="META-INF/SOURCE-MANIFEST.MF" tofile="${source-bundle-manifest}" overwrite="true" />
+                <replace file="${source-bundle-manifest}">
+                  <replacefilter token=".qualifier" value=".${maven.build.timestamp}" />
+                </replace>
+              </target>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-source-plugin</artifactId>
+          <inherited>true</inherited>
+          <executions>
+            <execution>
+              <id>attach-sources</id>
+              <phase>process-classes</phase>
+              <goals>
+                <goal>jar</goal>
+              </goals>
+            <configuration>
+              <archive>
+                <manifestFile>${source-bundle-manifest}</manifestFile>
+              </archive>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestFile>${bundle-manifest}</manifestFile>
+          </archive>
+        </configuration>
+      </plugin>
+
+      <!-- No previous version to compare to
+      <plugin>
+          <groupId>com.github.siom79.japicmp</groupId>
+          <artifactId>japicmp-maven-plugin</artifactId>
+          <version>${japicmp-version}</version>
+          <configuration>
+              <oldVersion>
+                  <dependency>
+                      <groupId>${project.groupId}</groupId>
+                      <artifactId>${project.artifactId}</artifactId>
+                      <version>${jgit-last-release-version}</version>
+                  </dependency>
+              </oldVersion>
+              <newVersion>
+                  <file>
+                      <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
+                  </file>
+              </newVersion>
+              <parameter>
+                  <onlyModified>true</onlyModified>
+                  <includes>
+                      <include>org.eclipse.jgit.*</include>
+                  </includes>
+                  <accessModifier>public</accessModifier>
+                  <breakBuildOnModifications>false</breakBuildOnModifications>
+                  <breakBuildOnBinaryIncompatibleModifications>false</breakBuildOnBinaryIncompatibleModifications>
+                  <onlyBinaryIncompatible>false</onlyBinaryIncompatible>
+                  <includeSynthetic>false</includeSynthetic>
+                  <ignoreMissingClasses>false</ignoreMissingClasses>
+                  <skipPomModules>true</skipPomModules>
+              </parameter>
+              <skip>false</skip>
+          </configuration>
+          <executions>
+            <execution>
+             <phase>verify</phase>
+             <goals>
+               <goal>cmp</goal>
+             </goals>
+          </execution>
+        </executions>
+      </plugin>
+      -->
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <!-- No previous version to compare to
+      <plugin>
+          <groupId>com.github.siom79.japicmp</groupId>
+          <artifactId>japicmp-maven-plugin</artifactId>
+          <version>${japicmp-version}</version>
+          <reportSets>
+              <reportSet>
+                  <reports>
+                      <report>cmp-report</report>
+                  </reports>
+              </reportSet>
+          </reportSets>
+          <configuration>
+              <oldVersion>
+                  <dependency>
+                      <groupId>${project.groupId}</groupId>
+                      <artifactId>${project.artifactId}</artifactId>
+                      <version>${jgit-last-release-version}</version>
+                  </dependency>
+              </oldVersion>
+              <newVersion>
+                  <file>
+                      <path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
+                  </file>
+              </newVersion>
+              <parameter>
+                  <onlyModified>true</onlyModified>
+                  <includes>
+                      <include>org.eclipse.jgit.*</include>
+                  </includes>
+                  <accessModifier>public</accessModifier>
+                  <breakBuildOnModifications>false</breakBuildOnModifications>
+                  <breakBuildOnBinaryIncompatibleModifications>false</breakBuildOnBinaryIncompatibleModifications>
+                  <onlyBinaryIncompatible>false</onlyBinaryIncompatible>
+                  <includeSynthetic>false</includeSynthetic>
+                  <ignoreMissingClasses>false</ignoreMissingClasses>
+                  <skipPomModules>true</skipPomModules>
+              </parameter>
+              <skip>false</skip>
+          </configuration>
+      </plugin>
+      -->
+    </plugins>
+  </reporting>
+</project>
diff --git a/org.eclipse.jgit.gpg.bc/resources/META-INF/services/org.eclipse.jgit.lib.GpgSigner b/org.eclipse.jgit.gpg.bc/resources/META-INF/services/org.eclipse.jgit.lib.GpgSigner
new file mode 100644 (file)
index 0000000..6752b64
--- /dev/null
@@ -0,0 +1 @@
+org.eclipse.jgit.gpg.bc.internal.BouncyCastleGpgSigner
diff --git a/org.eclipse.jgit.gpg.bc/resources/org/eclipse/jgit/gpg/bc/internal/BCText.properties b/org.eclipse.jgit.gpg.bc/resources/org/eclipse/jgit/gpg/bc/internal/BCText.properties
new file mode 100644 (file)
index 0000000..1441c63
--- /dev/null
@@ -0,0 +1,11 @@
+credentialPassphrase=Passphrase
+gpgFailedToParseSecretKey=Failed to parse secret key file in directory: {0}. Is the entered passphrase correct?
+gpgNoCredentialsProvider=missing credentials provider
+gpgNoKeyring=neither pubring.kbx nor secring.gpg files found
+gpgNoKeyInLegacySecring=no matching secret key found in legacy secring.gpg for key or user id: {0}
+gpgNoPublicKeyFound=Unable to find a public-key with key or user id: {0}
+gpgNoSecretKeyForPublicKey=unable to find associated secret key for public key: {0}
+gpgNotASigningKey=Secret key ({0}) is not suitable for signing
+gpgKeyInfo=GPG Key (fingerprint {0})
+gpgSigningCancelled=Signing was cancelled
+unableToSignCommitNoSecretKey=Unable to sign commit. Signing key not available.
diff --git a/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BCText.java b/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BCText.java
new file mode 100644 (file)
index 0000000..1a00b0f
--- /dev/null
@@ -0,0 +1,33 @@
+package org.eclipse.jgit.gpg.bc.internal;
+
+import org.eclipse.jgit.nls.NLS;
+import org.eclipse.jgit.nls.TranslationBundle;
+
+/**
+ * Externalized text messages for localization.
+ */
+public final class BCText extends TranslationBundle {
+
+       /**
+        * Get an instance of this translation bundle.
+        *
+        * @return an instance of this translation bundle
+        */
+       public static BCText get() {
+               return NLS.getBundleFor(BCText.class);
+       }
+
+       // @formatter:off
+       /***/ public String credentialPassphrase;
+       /***/ public String gpgFailedToParseSecretKey;
+       /***/ public String gpgNoCredentialsProvider;
+       /***/ public String gpgNoKeyring;
+       /***/ public String gpgNoKeyInLegacySecring;
+       /***/ public String gpgNoPublicKeyFound;
+       /***/ public String gpgNoSecretKeyForPublicKey;
+       /***/ public String gpgNotASigningKey;
+       /***/ public String gpgKeyInfo;
+       /***/ public String gpgSigningCancelled;
+       /***/ public String unableToSignCommitNoSecretKey;
+
+}
diff --git a/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKey.java b/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKey.java
new file mode 100644 (file)
index 0000000..bc26cb9
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2018, Salesforce. and others
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.gpg.bc.internal;
+
+import java.nio.file.Path;
+
+import org.bouncycastle.openpgp.PGPSecretKey;
+
+/**
+ * Container which holds a {@link #getSecretKey()} together with the
+ * {@link #getOrigin() path it was loaded from}.
+ */
+class BouncyCastleGpgKey {
+
+       private PGPSecretKey secretKey;
+
+       private Path origin;
+
+       public BouncyCastleGpgKey(PGPSecretKey secretKey, Path origin) {
+               this.secretKey = secretKey;
+               this.origin = origin;
+       }
+
+       public PGPSecretKey getSecretKey() {
+               return secretKey;
+       }
+
+       public Path getOrigin() {
+               return origin;
+       }
+}
\ No newline at end of file
diff --git a/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKeyLocator.java b/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKeyLocator.java
new file mode 100644 (file)
index 0000000..e6a48f8
--- /dev/null
@@ -0,0 +1,613 @@
+/*
+ * Copyright (C) 2018, Salesforce. and others
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.gpg.bc.internal;
+
+import static java.nio.file.Files.exists;
+import static java.nio.file.Files.newInputStream;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.text.MessageFormat;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.bouncycastle.gpg.SExprParser;
+import org.bouncycastle.gpg.keybox.BlobType;
+import org.bouncycastle.gpg.keybox.KeyBlob;
+import org.bouncycastle.gpg.keybox.KeyBox;
+import org.bouncycastle.gpg.keybox.KeyInformation;
+import org.bouncycastle.gpg.keybox.PublicKeyRingBlob;
+import org.bouncycastle.gpg.keybox.UserID;
+import org.bouncycastle.gpg.keybox.jcajce.JcaKeyBoxBuilder;
+import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.openpgp.PGPKeyFlags;
+import org.bouncycastle.openpgp.PGPPublicKey;
+import org.bouncycastle.openpgp.PGPPublicKeyRing;
+import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
+import org.bouncycastle.openpgp.PGPSecretKey;
+import org.bouncycastle.openpgp.PGPSecretKeyRing;
+import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
+import org.bouncycastle.openpgp.PGPSignature;
+import org.bouncycastle.openpgp.PGPUtil;
+import org.bouncycastle.openpgp.operator.PBEProtectionRemoverFactory;
+import org.bouncycastle.openpgp.operator.PGPDigestCalculatorProvider;
+import org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
+import org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder;
+import org.bouncycastle.openpgp.operator.jcajce.JcePBEProtectionRemoverFactory;
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.api.errors.CanceledException;
+import org.eclipse.jgit.errors.UnsupportedCredentialItem;
+import org.eclipse.jgit.util.FS;
+import org.eclipse.jgit.util.StringUtils;
+import org.eclipse.jgit.util.SystemReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Locates GPG keys from either <code>~/.gnupg/private-keys-v1.d</code> or
+ * <code>~/.gnupg/secring.gpg</code>
+ */
+public class BouncyCastleGpgKeyLocator {
+
+       /** Thrown if a keybox file exists but doesn't contain an OpenPGP key. */
+       private static class NoOpenPgpKeyException extends Exception {
+
+               private static final long serialVersionUID = 1L;
+
+       }
+
+       private static final Logger log = LoggerFactory
+                       .getLogger(BouncyCastleGpgKeyLocator.class);
+
+       private static final Path GPG_DIRECTORY = findGpgDirectory();
+
+       private static final Path USER_KEYBOX_PATH = GPG_DIRECTORY
+                       .resolve("pubring.kbx"); //$NON-NLS-1$
+
+       private static final Path USER_SECRET_KEY_DIR = GPG_DIRECTORY
+                       .resolve("private-keys-v1.d"); //$NON-NLS-1$
+
+       private static final Path USER_PGP_PUBRING_FILE = GPG_DIRECTORY
+                       .resolve("pubring.gpg"); //$NON-NLS-1$
+
+       private static final Path USER_PGP_LEGACY_SECRING_FILE = GPG_DIRECTORY
+                       .resolve("secring.gpg"); //$NON-NLS-1$
+
+       private final String signingKey;
+
+       private BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt;
+
+       private static Path findGpgDirectory() {
+               SystemReader system = SystemReader.getInstance();
+               if (system.isWindows()) {
+                       // On Windows prefer %APPDATA%\gnupg if it exists, even if Cygwin is
+                       // used.
+                       String appData = system.getenv("APPDATA"); //$NON-NLS-1$
+                       if (appData != null && !appData.isEmpty()) {
+                               try {
+                                       Path directory = Paths.get(appData).resolve("gnupg"); //$NON-NLS-1$
+                                       if (Files.isDirectory(directory)) {
+                                               return directory;
+                                       }
+                               } catch (SecurityException | InvalidPathException e) {
+                                       // Ignore and return the default location below.
+                               }
+                       }
+               }
+               // All systems, including Cygwin and even Windows if
+               // %APPDATA%\gnupg doesn't exist: ~/.gnupg
+               File home = FS.DETECTED.userHome();
+               if (home == null) {
+                       // Oops. What now?
+                       home = new File(".").getAbsoluteFile(); //$NON-NLS-1$
+               }
+               return home.toPath().resolve(".gnupg"); //$NON-NLS-1$
+       }
+
+       /**
+        * Create a new key locator for the specified signing key.
+        * <p>
+        * The signing key must either be a hex representation of a specific key or
+        * a user identity substring (eg., email address). All keys in the KeyBox
+        * will be looked up in the order as returned by the KeyBox. A key id will
+        * be searched before attempting to find a key by user id.
+        * </p>
+        *
+        * @param signingKey
+        *            the signing key to search for
+        * @param passphrasePrompt
+        *            the provider to use when asking for key passphrase
+        */
+       public BouncyCastleGpgKeyLocator(String signingKey,
+                       @NonNull BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt) {
+               this.signingKey = signingKey;
+               this.passphrasePrompt = passphrasePrompt;
+       }
+
+       private PGPSecretKey attemptParseSecretKey(Path keyFile,
+                       PGPDigestCalculatorProvider calculatorProvider,
+                       PBEProtectionRemoverFactory passphraseProvider,
+                       PGPPublicKey publicKey) {
+               try (InputStream in = newInputStream(keyFile)) {
+                       return new SExprParser(calculatorProvider).parseSecretKey(
+                                       new BufferedInputStream(in), passphraseProvider, publicKey);
+               } catch (IOException | PGPException | ClassCastException e) {
+                       if (log.isDebugEnabled())
+                               log.debug("Ignoring unreadable file '{}': {}", keyFile, //$NON-NLS-1$
+                                               e.getMessage(), e);
+                       return null;
+               }
+       }
+
+       /**
+        * Checks whether a given OpenPGP {@code userId} matches a given
+        * {@code signingKeySpec}, which is supposed to have one of the formats
+        * defined by GPG.
+        * <p>
+        * Not all formats are supported; only formats starting with '=', '&lt;',
+        * '@', and '*' are handled. Any other format results in a case-insensitive
+        * substring match.
+        * </p>
+        *
+        * @param userId
+        *            of a key
+        * @param signingKeySpec
+        *            GPG key identification
+        * @return whether the {@code userId} matches
+        * @see <a href=
+        *      "https://www.gnupg.org/documentation/manuals/gnupg/Specify-a-User-ID.html">GPG
+        *      Documentation: How to Specify a User ID</a>
+        */
+       static boolean containsSigningKey(String userId, String signingKeySpec) {
+               if (StringUtils.isEmptyOrNull(userId)
+                               || StringUtils.isEmptyOrNull(signingKeySpec)) {
+                       return false;
+               }
+               String toMatch = signingKeySpec;
+               if (toMatch.startsWith("0x") && toMatch.trim().length() > 2) { //$NON-NLS-1$
+                       return false; // Explicit fingerprint
+               }
+               int command = toMatch.charAt(0);
+               switch (command) {
+               case '=':
+               case '<':
+               case '@':
+               case '*':
+                       toMatch = toMatch.substring(1);
+                       if (toMatch.isEmpty()) {
+                               return false;
+                       }
+                       break;
+               default:
+                       break;
+               }
+               switch (command) {
+               case '=':
+                       return userId.equals(toMatch);
+               case '<': {
+                       int begin = userId.indexOf('<');
+                       int end = userId.indexOf('>', begin + 1);
+                       int stop = toMatch.indexOf('>');
+                       return begin >= 0 && end > begin + 1 && stop > 0
+                                       && userId.substring(begin + 1, end)
+                                                       .equals(toMatch.substring(0, stop));
+               }
+               case '@': {
+                       int begin = userId.indexOf('<');
+                       int end = userId.indexOf('>', begin + 1);
+                       return begin >= 0 && end > begin + 1
+                                       && userId.substring(begin + 1, end).contains(toMatch);
+               }
+               default:
+                       if (toMatch.trim().isEmpty()) {
+                               return false;
+                       }
+                       return userId.toLowerCase(Locale.ROOT)
+                                       .contains(toMatch.toLowerCase(Locale.ROOT));
+               }
+       }
+
+       private String toFingerprint(String keyId) {
+               if (keyId.startsWith("0x")) { //$NON-NLS-1$
+                       return keyId.substring(2);
+               }
+               return keyId;
+       }
+
+       private PGPPublicKey findPublicKeyByKeyId(KeyBlob keyBlob)
+                       throws IOException {
+               String keyId = toFingerprint(signingKey).toLowerCase(Locale.ROOT);
+               if (keyId.isEmpty()) {
+                       return null;
+               }
+               for (KeyInformation keyInfo : keyBlob.getKeyInformation()) {
+                       String fingerprint = Hex.toHexString(keyInfo.getFingerprint())
+                                       .toLowerCase(Locale.ROOT);
+                       if (fingerprint.endsWith(keyId)) {
+                               return getPublicKey(keyBlob, keyInfo.getFingerprint());
+                       }
+               }
+               return null;
+       }
+
+       private PGPPublicKey findPublicKeyByUserId(KeyBlob keyBlob)
+                       throws IOException {
+               for (UserID userID : keyBlob.getUserIds()) {
+                       if (containsSigningKey(userID.getUserIDAsString(), signingKey)) {
+                               return getSigningPublicKey(keyBlob);
+                       }
+               }
+               return null;
+       }
+
+       /**
+        * Finds a public key associated with the signing key.
+        *
+        * @param keyboxFile
+        *            the KeyBox file
+        * @return publicKey the public key (maybe <code>null</code>)
+        * @throws IOException
+        *             in case of problems reading the file
+        * @throws NoSuchAlgorithmException
+        * @throws NoSuchProviderException
+        * @throws NoOpenPgpKeyException
+        *             if the file does not contain any OpenPGP key
+        */
+       private PGPPublicKey findPublicKeyInKeyBox(Path keyboxFile)
+                       throws IOException, NoSuchAlgorithmException,
+                       NoSuchProviderException, NoOpenPgpKeyException {
+               KeyBox keyBox = readKeyBoxFile(keyboxFile);
+               boolean hasOpenPgpKey = false;
+               for (KeyBlob keyBlob : keyBox.getKeyBlobs()) {
+                       if (keyBlob.getType() == BlobType.OPEN_PGP_BLOB) {
+                               hasOpenPgpKey = true;
+                               PGPPublicKey key = findPublicKeyByKeyId(keyBlob);
+                               if (key != null) {
+                                       return key;
+                               }
+                               key = findPublicKeyByUserId(keyBlob);
+                               if (key != null) {
+                                       return key;
+                               }
+                       }
+               }
+               if (!hasOpenPgpKey) {
+                       throw new NoOpenPgpKeyException();
+               }
+               return null;
+       }
+
+       /**
+        * If there is a private key directory containing keys, use pubring.kbx or
+        * pubring.gpg to find the public key; then try to find the secret key in
+        * the directory.
+        * <p>
+        * If there is no private key directory (or it doesn't contain any keys),
+        * try to find the key in secring.gpg directly.
+        * </p>
+        *
+        * @return the secret key
+        * @throws IOException
+        *             in case of issues reading key files
+        * @throws NoSuchAlgorithmException
+        * @throws NoSuchProviderException
+        * @throws PGPException
+        *             in case of issues finding a key, including no key found
+        * @throws CanceledException
+        * @throws URISyntaxException
+        * @throws UnsupportedCredentialItem
+        */
+       @NonNull
+       public BouncyCastleGpgKey findSecretKey() throws IOException,
+                       NoSuchAlgorithmException, NoSuchProviderException, PGPException,
+                       CanceledException, UnsupportedCredentialItem, URISyntaxException {
+               BouncyCastleGpgKey key;
+               PGPPublicKey publicKey = null;
+               if (hasKeyFiles(USER_SECRET_KEY_DIR)) {
+                       // Use pubring.kbx or pubring.gpg to find the public key, then try
+                       // the key files in the directory. If the public key was found in
+                       // pubring.gpg also try secring.gpg to find the secret key.
+                       if (exists(USER_KEYBOX_PATH)) {
+                               try {
+                                       publicKey = findPublicKeyInKeyBox(USER_KEYBOX_PATH);
+                                       if (publicKey != null) {
+                                               key = findSecretKeyForKeyBoxPublicKey(publicKey,
+                                                               USER_KEYBOX_PATH);
+                                               if (key != null) {
+                                                       return key;
+                                               }
+                                               throw new PGPException(MessageFormat.format(
+                                                               BCText.get().gpgNoSecretKeyForPublicKey,
+                                                               Long.toHexString(publicKey.getKeyID())));
+                                       }
+                                       throw new PGPException(MessageFormat.format(
+                                                       BCText.get().gpgNoPublicKeyFound, signingKey));
+                               } catch (NoOpenPgpKeyException e) {
+                                       // There are no OpenPGP keys in the keybox at all: try the
+                                       // pubring.gpg, if it exists.
+                                       if (log.isDebugEnabled()) {
+                                               log.debug("{} does not contain any OpenPGP keys", //$NON-NLS-1$
+                                                               USER_KEYBOX_PATH);
+                                       }
+                               }
+                       }
+                       if (exists(USER_PGP_PUBRING_FILE)) {
+                               publicKey = findPublicKeyInPubring(USER_PGP_PUBRING_FILE);
+                               if (publicKey != null) {
+                                       // GPG < 2.1 may have both; the agent using the directory
+                                       // and gpg using secring.gpg. GPG >= 2.1 delegates all
+                                       // secret key handling to the agent and doesn't use
+                                       // secring.gpg at all, even if it exists. Which means for us
+                                       // we have to try both since we don't know which GPG version
+                                       // the user has.
+                                       key = findSecretKeyForKeyBoxPublicKey(publicKey,
+                                                       USER_PGP_PUBRING_FILE);
+                                       if (key != null) {
+                                               return key;
+                                       }
+                               }
+                       }
+                       if (publicKey == null) {
+                               throw new PGPException(MessageFormat.format(
+                                               BCText.get().gpgNoPublicKeyFound, signingKey));
+                       }
+                       // We found a public key, but didn't find the secret key in the
+                       // private key directory. Go try the secring.gpg.
+               }
+               boolean hasSecring = false;
+               if (exists(USER_PGP_LEGACY_SECRING_FILE)) {
+                       hasSecring = true;
+                       key = loadKeyFromSecring(USER_PGP_LEGACY_SECRING_FILE);
+                       if (key != null) {
+                               return key;
+                       }
+               }
+               if (publicKey != null) {
+                       throw new PGPException(MessageFormat.format(
+                                       BCText.get().gpgNoSecretKeyForPublicKey,
+                                       Long.toHexString(publicKey.getKeyID())));
+               } else if (hasSecring) {
+                       // publicKey == null: user has _only_ pubring.gpg/secring.gpg.
+                       throw new PGPException(MessageFormat.format(
+                                       BCText.get().gpgNoKeyInLegacySecring, signingKey));
+               } else {
+                       throw new PGPException(BCText.get().gpgNoKeyring);
+               }
+       }
+
+       private boolean hasKeyFiles(Path dir) {
+               try (DirectoryStream<Path> contents = Files.newDirectoryStream(dir,
+                               "*.key")) { //$NON-NLS-1$
+                       return contents.iterator().hasNext();
+               } catch (IOException e) {
+                       // Not a directory, or something else
+                       return false;
+               }
+       }
+
+       private BouncyCastleGpgKey loadKeyFromSecring(Path secring)
+                       throws IOException, PGPException {
+               PGPSecretKey secretKey = findSecretKeyInLegacySecring(signingKey,
+                               secring);
+
+               if (secretKey != null) {
+                       if (!secretKey.isSigningKey()) {
+                               throw new PGPException(MessageFormat
+                                               .format(BCText.get().gpgNotASigningKey, signingKey));
+                       }
+                       return new BouncyCastleGpgKey(secretKey, secring);
+               }
+               return null;
+       }
+
+       private BouncyCastleGpgKey findSecretKeyForKeyBoxPublicKey(
+                       PGPPublicKey publicKey, Path userKeyboxPath)
+                       throws PGPException, CanceledException, UnsupportedCredentialItem,
+                       URISyntaxException {
+               /*
+                * this is somewhat brute-force but there doesn't seem to be another
+                * way; we have to walk all private key files we find and try to open
+                * them
+                */
+
+               PGPDigestCalculatorProvider calculatorProvider = new JcaPGPDigestCalculatorProviderBuilder()
+                               .build();
+
+               PBEProtectionRemoverFactory passphraseProvider = new JcePBEProtectionRemoverFactory(
+                               passphrasePrompt.getPassphrase(publicKey.getFingerprint(),
+                                               userKeyboxPath));
+
+               try (Stream<Path> keyFiles = Files.walk(USER_SECRET_KEY_DIR)) {
+                       for (Path keyFile : keyFiles.filter(Files::isRegularFile)
+                                       .collect(Collectors.toList())) {
+                               PGPSecretKey secretKey = attemptParseSecretKey(keyFile,
+                                               calculatorProvider, passphraseProvider, publicKey);
+                               if (secretKey != null) {
+                                       if (!secretKey.isSigningKey()) {
+                                               throw new PGPException(MessageFormat.format(
+                                                               BCText.get().gpgNotASigningKey, signingKey));
+                                       }
+                                       return new BouncyCastleGpgKey(secretKey, userKeyboxPath);
+                               }
+                       }
+
+                       passphrasePrompt.clear();
+                       return null;
+               } catch (RuntimeException e) {
+                       passphrasePrompt.clear();
+                       throw e;
+               } catch (IOException e) {
+                       passphrasePrompt.clear();
+                       throw new PGPException(MessageFormat.format(
+                                       BCText.get().gpgFailedToParseSecretKey,
+                                       USER_SECRET_KEY_DIR.toAbsolutePath()), e);
+               }
+       }
+
+       /**
+        * Return the first suitable key for signing in the key ring collection. For
+        * this case we only expect there to be one key available for signing.
+        * </p>
+        *
+        * @param signingkey
+        * @param secringFile
+        *
+        * @return the first suitable PGP secret key found for signing
+        * @throws IOException
+        *             on I/O related errors
+        * @throws PGPException
+        *             on BouncyCastle errors
+        */
+       private PGPSecretKey findSecretKeyInLegacySecring(String signingkey,
+                       Path secringFile) throws IOException, PGPException {
+
+               try (InputStream in = newInputStream(secringFile)) {
+                       PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(
+                                       PGPUtil.getDecoderStream(new BufferedInputStream(in)),
+                                       new JcaKeyFingerprintCalculator());
+
+                       String keyId = toFingerprint(signingkey).toLowerCase(Locale.ROOT);
+                       Iterator<PGPSecretKeyRing> keyrings = pgpSec.getKeyRings();
+                       while (keyrings.hasNext()) {
+                               PGPSecretKeyRing keyRing = keyrings.next();
+                               Iterator<PGPSecretKey> keys = keyRing.getSecretKeys();
+                               while (keys.hasNext()) {
+                                       PGPSecretKey key = keys.next();
+                                       // try key id
+                                       String fingerprint = Hex
+                                                       .toHexString(key.getPublicKey().getFingerprint())
+                                                       .toLowerCase(Locale.ROOT);
+                                       if (fingerprint.endsWith(keyId)) {
+                                               return key;
+                                       }
+                                       // try user id
+                                       Iterator<String> userIDs = key.getUserIDs();
+                                       while (userIDs.hasNext()) {
+                                               String userId = userIDs.next();
+                                               if (containsSigningKey(userId, signingKey)) {
+                                                       return key;
+                                               }
+                                       }
+                               }
+                       }
+               }
+               return null;
+       }
+
+       /**
+        * Return the first public key matching the key id ({@link #signingKey}.
+        *
+        * @param pubringFile
+        *
+        * @return the PGP public key, or {@code null} if none found
+        * @throws IOException
+        *             on I/O related errors
+        * @throws PGPException
+        *             on BouncyCastle errors
+        */
+       private PGPPublicKey findPublicKeyInPubring(Path pubringFile)
+                       throws IOException, PGPException {
+               try (InputStream in = newInputStream(pubringFile)) {
+                       PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(
+                                       new BufferedInputStream(in),
+                                       new JcaKeyFingerprintCalculator());
+
+                       String keyId = toFingerprint(signingKey).toLowerCase(Locale.ROOT);
+                       Iterator<PGPPublicKeyRing> keyrings = pgpPub.getKeyRings();
+                       while (keyrings.hasNext()) {
+                               PGPPublicKeyRing keyRing = keyrings.next();
+                               Iterator<PGPPublicKey> keys = keyRing.getPublicKeys();
+                               while (keys.hasNext()) {
+                                       PGPPublicKey key = keys.next();
+                                       // try key id
+                                       String fingerprint = Hex.toHexString(key.getFingerprint())
+                                                       .toLowerCase(Locale.ROOT);
+                                       if (fingerprint.endsWith(keyId)) {
+                                               return key;
+                                       }
+                                       // try user id
+                                       Iterator<String> userIDs = key.getUserIDs();
+                                       while (userIDs.hasNext()) {
+                                               String userId = userIDs.next();
+                                               if (containsSigningKey(userId, signingKey)) {
+                                                       return key;
+                                               }
+                                       }
+                               }
+                       }
+               }
+               return null;
+       }
+
+       private PGPPublicKey getPublicKey(KeyBlob blob, byte[] fingerprint)
+                       throws IOException {
+               return ((PublicKeyRingBlob) blob).getPGPPublicKeyRing()
+                               .getPublicKey(fingerprint);
+       }
+
+       private PGPPublicKey getSigningPublicKey(KeyBlob blob) throws IOException {
+               PGPPublicKey masterKey = null;
+               Iterator<PGPPublicKey> keys = ((PublicKeyRingBlob) blob)
+                               .getPGPPublicKeyRing().getPublicKeys();
+               while (keys.hasNext()) {
+                       PGPPublicKey key = keys.next();
+                       // only consider keys that have the [S] usage flag set
+                       if (isSigningKey(key)) {
+                               if (key.isMasterKey()) {
+                                       masterKey = key;
+                               } else {
+                                       return key;
+                               }
+                       }
+               }
+               // return the master key if no other signing key was found or null if
+               // the master key did not have the signing flag set
+               return masterKey;
+       }
+
+       private boolean isSigningKey(PGPPublicKey key) {
+               Iterator signatures = key.getSignatures();
+               while (signatures.hasNext()) {
+                       PGPSignature sig = (PGPSignature) signatures.next();
+                       if ((sig.getHashedSubPackets().getKeyFlags()
+                                       & PGPKeyFlags.CAN_SIGN) > 0) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+
+       private KeyBox readKeyBoxFile(Path keyboxFile) throws IOException,
+                       NoSuchAlgorithmException, NoSuchProviderException,
+                       NoOpenPgpKeyException {
+               if (keyboxFile.toFile().length() == 0) {
+                       throw new NoOpenPgpKeyException();
+               }
+               KeyBox keyBox;
+               try (InputStream in = new BufferedInputStream(
+                               newInputStream(keyboxFile))) {
+                       keyBox = new JcaKeyBoxBuilder().build(in);
+               }
+               return keyBox;
+       }
+}
diff --git a/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKeyPassphrasePrompt.java b/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgKeyPassphrasePrompt.java
new file mode 100644 (file)
index 0000000..740f597
--- /dev/null
@@ -0,0 +1,100 @@
+/*-
+ * Copyright (C) 2019, Salesforce. and others
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.gpg.bc.internal;
+
+import java.net.URISyntaxException;
+import java.nio.file.Path;
+import java.text.MessageFormat;
+
+import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.jgit.api.errors.CanceledException;
+import org.eclipse.jgit.errors.UnsupportedCredentialItem;
+import org.eclipse.jgit.transport.CredentialItem.CharArrayType;
+import org.eclipse.jgit.transport.CredentialItem.InformationalMessage;
+import org.eclipse.jgit.transport.CredentialsProvider;
+import org.eclipse.jgit.transport.URIish;
+
+/**
+ * Prompts for a passphrase and caches it until {@link #clear() cleared}.
+ * <p>
+ * Implements {@link AutoCloseable} so it can be used within a
+ * try-with-resources block.
+ * </p>
+ */
+class BouncyCastleGpgKeyPassphrasePrompt implements AutoCloseable {
+
+       private CharArrayType passphrase;
+
+       private CredentialsProvider credentialsProvider;
+
+       public BouncyCastleGpgKeyPassphrasePrompt(
+                       CredentialsProvider credentialsProvider) {
+               this.credentialsProvider = credentialsProvider;
+       }
+
+       /**
+        * Clears any cached passphrase
+        */
+       public void clear() {
+               if (passphrase != null) {
+                       passphrase.clear();
+                       passphrase = null;
+               }
+       }
+
+       @Override
+       public void close() {
+               clear();
+       }
+
+       private URIish createURI(Path keyLocation) throws URISyntaxException {
+               return new URIish(keyLocation.toUri().toString());
+       }
+
+       /**
+        * Prompts use for a passphrase unless one was cached from a previous
+        * prompt.
+        *
+        * @param keyFingerprint
+        *            the fingerprint to show to the user during prompting
+        * @param keyLocation
+        *            the location the key was loaded from
+        * @return the passphrase (maybe <code>null</code>)
+        * @throws PGPException
+        * @throws CanceledException
+        *             in case passphrase was not entered by user
+        * @throws URISyntaxException
+        * @throws UnsupportedCredentialItem
+        */
+       public char[] getPassphrase(byte[] keyFingerprint, Path keyLocation)
+                       throws PGPException, CanceledException, UnsupportedCredentialItem,
+                       URISyntaxException {
+               if (passphrase == null) {
+                       passphrase = new CharArrayType(BCText.get().credentialPassphrase,
+                                       true);
+               }
+
+               if (credentialsProvider == null) {
+                       throw new PGPException(BCText.get().gpgNoCredentialsProvider);
+               }
+
+               if (passphrase.getValue() == null
+                               && !credentialsProvider.get(createURI(keyLocation),
+                                               new InformationalMessage(
+                                                               MessageFormat.format(BCText.get().gpgKeyInfo,
+                                                                               Hex.toHexString(keyFingerprint))),
+                                               passphrase)) {
+                       throw new CanceledException(BCText.get().gpgSigningCancelled);
+               }
+               return passphrase.getValue();
+       }
+
+}
diff --git a/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgSigner.java b/org.eclipse.jgit.gpg.bc/src/org/eclipse/jgit/gpg/bc/internal/BouncyCastleGpgSigner.java
new file mode 100644 (file)
index 0000000..fc6c156
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2018, Salesforce. and others
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.gpg.bc.internal;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Security;
+
+import org.bouncycastle.bcpg.ArmoredOutputStream;
+import org.bouncycastle.bcpg.BCPGOutputStream;
+import org.bouncycastle.bcpg.HashAlgorithmTags;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.openpgp.PGPPrivateKey;
+import org.bouncycastle.openpgp.PGPSecretKey;
+import org.bouncycastle.openpgp.PGPSignature;
+import org.bouncycastle.openpgp.PGPSignatureGenerator;
+import org.bouncycastle.openpgp.PGPSignatureSubpacketGenerator;
+import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
+import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.annotations.Nullable;
+import org.eclipse.jgit.api.errors.CanceledException;
+import org.eclipse.jgit.api.errors.JGitInternalException;
+import org.eclipse.jgit.errors.UnsupportedCredentialItem;
+import org.eclipse.jgit.lib.CommitBuilder;
+import org.eclipse.jgit.lib.GpgSignature;
+import org.eclipse.jgit.lib.GpgSigner;
+import org.eclipse.jgit.lib.PersonIdent;
+import org.eclipse.jgit.transport.CredentialsProvider;
+
+/**
+ * GPG Signer using BouncyCastle library
+ */
+public class BouncyCastleGpgSigner extends GpgSigner {
+
+       private static void registerBouncyCastleProviderIfNecessary() {
+               if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
+                       Security.addProvider(new BouncyCastleProvider());
+               }
+       }
+
+       /**
+        * Create a new instance.
+        * <p>
+        * The BounceCastleProvider will be registered if necessary.
+        * </p>
+        */
+       public BouncyCastleGpgSigner() {
+               registerBouncyCastleProviderIfNecessary();
+       }
+
+       @Override
+       public boolean canLocateSigningKey(@Nullable String gpgSigningKey,
+                       PersonIdent committer, CredentialsProvider credentialsProvider)
+                       throws CanceledException {
+               try (BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt = new BouncyCastleGpgKeyPassphrasePrompt(
+                               credentialsProvider)) {
+                       BouncyCastleGpgKey gpgKey = locateSigningKey(gpgSigningKey,
+                                       committer, passphrasePrompt);
+                       return gpgKey != null;
+               } catch (PGPException | IOException | NoSuchAlgorithmException
+                               | NoSuchProviderException | URISyntaxException e) {
+                       return false;
+               }
+       }
+
+       private BouncyCastleGpgKey locateSigningKey(@Nullable String gpgSigningKey,
+                       PersonIdent committer,
+                       BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt)
+                       throws CanceledException, UnsupportedCredentialItem, IOException,
+                       NoSuchAlgorithmException, NoSuchProviderException, PGPException,
+                       URISyntaxException {
+               if (gpgSigningKey == null || gpgSigningKey.isEmpty()) {
+                       gpgSigningKey = '<' + committer.getEmailAddress() + '>';
+               }
+
+               BouncyCastleGpgKeyLocator keyHelper = new BouncyCastleGpgKeyLocator(
+                               gpgSigningKey, passphrasePrompt);
+
+               return keyHelper.findSecretKey();
+       }
+
+       @Override
+       public void sign(@NonNull CommitBuilder commit,
+                       @Nullable String gpgSigningKey, @NonNull PersonIdent committer,
+                       CredentialsProvider credentialsProvider) throws CanceledException {
+               try (BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt = new BouncyCastleGpgKeyPassphrasePrompt(
+                               credentialsProvider)) {
+                       BouncyCastleGpgKey gpgKey = locateSigningKey(gpgSigningKey,
+                                       committer, passphrasePrompt);
+                       PGPSecretKey secretKey = gpgKey.getSecretKey();
+                       if (secretKey == null) {
+                               throw new JGitInternalException(
+                                               BCText.get().unableToSignCommitNoSecretKey);
+                       }
+                       char[] passphrase = passphrasePrompt.getPassphrase(
+                                       secretKey.getPublicKey().getFingerprint(),
+                                       gpgKey.getOrigin());
+                       PGPPrivateKey privateKey = secretKey
+                                       .extractPrivateKey(new JcePBESecretKeyDecryptorBuilder()
+                                                       .setProvider(BouncyCastleProvider.PROVIDER_NAME)
+                                                       .build(passphrase));
+                       PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(
+                                       new JcaPGPContentSignerBuilder(
+                                                       secretKey.getPublicKey().getAlgorithm(),
+                                                       HashAlgorithmTags.SHA256).setProvider(
+                                                                       BouncyCastleProvider.PROVIDER_NAME));
+                       signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey);
+                       PGPSignatureSubpacketGenerator subpacketGenerator = new PGPSignatureSubpacketGenerator();
+                       subpacketGenerator.setIssuerFingerprint(false,
+                                       secretKey.getPublicKey());
+                       signatureGenerator
+                                       .setHashedSubpackets(subpacketGenerator.generate());
+                       ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+                       try (BCPGOutputStream out = new BCPGOutputStream(
+                                       new ArmoredOutputStream(buffer))) {
+                               signatureGenerator.update(commit.build());
+                               signatureGenerator.generate().encode(out);
+                       }
+                       commit.setGpgSignature(new GpgSignature(buffer.toByteArray()));
+               } catch (PGPException | IOException | NoSuchAlgorithmException
+                               | NoSuchProviderException | URISyntaxException e) {
+                       throw new JGitInternalException(e.getMessage(), e);
+               }
+       }
+}
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.gitignore b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.gitignore
new file mode 100644 (file)
index 0000000..2f7896d
--- /dev/null
@@ -0,0 +1 @@
+target/
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.project b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.project
new file mode 100644 (file)
index 0000000..76a6f7b
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.eclipse.jgit.gpg.bc.feature</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.pde.FeatureBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.FeatureNature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.core.runtime.prefs
new file mode 100644 (file)
index 0000000..5a0ad22
--- /dev/null
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.m2e.core.prefs
new file mode 100644 (file)
index 0000000..f897a7f
--- /dev/null
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.mylyn.tasks.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.mylyn.tasks.ui.prefs
new file mode 100644 (file)
index 0000000..3dec4d9
--- /dev/null
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+project.repository.kind=bugzilla
+project.repository.url=https\://bugs.eclipse.org/bugs
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/.settings/org.eclipse.mylyn.team.ui.prefs
new file mode 100644 (file)
index 0000000..984263d
--- /dev/null
@@ -0,0 +1,2 @@
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
+eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/build.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/build.properties
new file mode 100644 (file)
index 0000000..b4a8dde
--- /dev/null
@@ -0,0 +1,4 @@
+bin.includes = feature.xml,\
+               edl-v10.html,\
+               feature.properties,\
+               license.html
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/edl-v10.html b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/edl-v10.html
new file mode 100644 (file)
index 0000000..1826b47
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Distribution License - Version 1.0</title>
+<style type="text/css">
+  body {
+    size: 8.5in 11.0in;
+    margin: 0.25in 0.5in 0.25in 0.5in;
+    tab-interval: 0.5in;
+    }
+  p {
+    margin-left: auto;
+    margin-top:  0.5em;
+    margin-bottom: 0.5em;
+    }
+  p.list {
+    margin-left: 0.5in;
+    margin-top:  0.05em;
+    margin-bottom: 0.05em;
+    }
+  </style>
+
+</head>
+
+<body lang="EN-US">
+
+<p><b>Eclipse Distribution License - v 1.0</b></p>
+
+<p>Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. </p>
+
+<p>All rights reserved.</p>
+<p>Redistribution and use in source and binary forms, with or without modification,
+    are permitted provided that the following conditions are met:
+<ul><li>Redistributions of source code must retain the above copyright notice,
+    this list of conditions and the following disclaimer.</li>
+<li>Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.</li>
+<li>Neither the name of the Eclipse Foundation, Inc. nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.</li></ul>
+</p>
+<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.</p>
+
+</body>
+
+</html>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/feature.properties
new file mode 100644 (file)
index 0000000..b14f0de
--- /dev/null
@@ -0,0 +1,176 @@
+###############################################################################
+# Copyright (c) 2000, 2010 IBM Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+###############################################################################
+
+featureName=Java implementation of Git - GPG support using BouncyCastle
+providerName=Eclipse JGit
+
+updateSiteName=Eclipse JGit Update Site
+
+# description property - text of the "Feature Description"
+description=\
+GPG support using BouncyCastle.\n
+################ end of description property ##################################
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2020 Matthias Sohn and others.\n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Distribution License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/org/documents/edl-v10.html\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+\n\
+November 22, 2017\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION\n\
+AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF\n\
+THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE\n\
+TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED\n\
+BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE\n\
+AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY\n\
+APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU\n\
+MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
+is provided to you under the terms and conditions of the Eclipse Public License\n\
+Version 2.0 ("EPL"). A copy of the EPL is provided with this Content and is also\n\
+available at http://www.eclipse.org/legal/epl-2.0. For purposes of the EPL,\n\
+"Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code, documentation\n\
+and other files maintained in the Eclipse Foundation source code repository\n\
+("Repository") in software modules ("Modules") and made available as\n\
+downloadable archives ("Downloads").\n\
+\n\
+-   Content may be structured and packaged into modules to facilitate\n\
+    delivering, extending, and upgrading the Content. Typical modules may\n\
+    include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and\n\
+    features ("Features").\n\
+-   Each Plug-in or Fragment may be packaged as a sub-directory or JAR\n\
+    (Java\u2122 ARchive) in a directory named "plugins".\n\
+-   A Feature is a bundle of one or more Plug-ins and/or Fragments and\n\
+    associated material. Each Feature may be packaged as a sub-directory in a\n\
+    directory named "features". Within a Feature, files named "feature.xml" may\n\
+    contain a list of the names and version numbers of the Plug-ins and/or\n\
+    Fragments associated with that Feature.\n\
+-   Features may also include other Features ("Included Features"). Within a\n\
+    Feature, files named "feature.xml" may contain a list of the names and\n\
+    version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be contained in\n\
+files named "about.html" ("Abouts"). The terms and conditions governing Features\n\
+and Included Features should be contained in files named "license.html"\n\
+("Feature Licenses"). Abouts and Feature Licenses may be located in any\n\
+directory of a Download or Module including, but not limited to the following\n\
+locations:\n\
+\n\
+-   The top-level (root) directory\n\
+-   Plug-in and Fragment directories\n\
+-   Inside Plug-ins and Fragments packaged as JARs\n\
+-   Sub-directories of the directory named "src" of certain Plug-ins\n\
+-   Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using\n\
+the Provisioning Technology (as defined below), you must agree to a license\n\
+("Feature Update License") during the installation process. If the Feature\n\
+contains Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform you\n\
+where you can locate them. Feature Update Licenses may be found in the "license"\n\
+property of files named "feature.properties" found within a Feature. Such\n\
+Abouts, Feature Licenses, and Feature Update Licenses contain the terms and\n\
+conditions (or references to such terms and conditions) that govern your use of\n\
+the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL\n\
+OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE\n\
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+-   Eclipse Public License Version 1.0 (available at\n\
+    http://www.eclipse.org/legal/epl-v10.html)\n\
+-   Eclipse Distribution License Version 1.0 (available at\n\
+    http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+-   Common Public License Version 1.0 (available at\n\
+    http://www.eclipse.org/legal/cpl-v10.html)\n\
+-   Apache Software License 1.1 (available at\n\
+    http://www.apache.org/licenses/LICENSE)\n\
+-   Apache Software License 2.0 (available at\n\
+    http://www.apache.org/licenses/LICENSE-2.0)\n\
+-   Mozilla Public License Version 1.1 (available at\n\
+    http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO\n\
+USE OF THE CONTENT. If no About, Feature License, or Feature Update License is\n\
+provided, please contact the Eclipse Foundation to determine what terms and\n\
+conditions govern that particular Content.\n\
+\n\
+Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which\n\
+include, but are not limited to, p2 and the Eclipse Update Manager\n\
+("Provisioning Technology") for the purpose of allowing users to install\n\
+software, documentation, information and/or other materials (collectively\n\
+"Installable Software"). This capability is provided with the intent of allowing\n\
+such users to install, extend and update Eclipse-based products. Information\n\
+about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install\n\
+Installable Software. You shall be responsible for enabling the applicable\n\
+license agreements relating to the Installable Software to be presented to, and\n\
+accepted by, the users of the Provisioning Technology in accordance with the\n\
+Specification. By using Provisioning Technology in such a manner and making it\n\
+available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the\n\
+following:\n\
+\n\
+1.  A series of actions may occur ("Provisioning Process") in which a user may\n\
+    execute the Provisioning Technology on a machine ("Target Machine") with the\n\
+    intent of installing, extending or updating the functionality of an\n\
+    Eclipse-based product.\n\
+2.  During the Provisioning Process, the Provisioning Technology may cause third\n\
+    party Installable Software or a portion thereof to be accessed and copied to\n\
+    the Target Machine.\n\
+3.  Pursuant to the Specification, you will provide to the user the terms and\n\
+    conditions that govern the use of the Installable Software ("Installable\n\
+    Software Agreement") and such Installable Software Agreement shall be\n\
+    accessed from the Target Machine in accordance with the Specification. Such\n\
+    Installable Software Agreement must inform the user of the terms and\n\
+    conditions that govern the Installable Software and must solicit acceptance\n\
+    by the end user in the manner prescribed in such Installable\n\
+    Software Agreement. Upon such indication of agreement by the user, the\n\
+    provisioning Technology will complete installation of the\n\
+    Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are currently\n\
+may have restrictions on the import, possession, and use, and/or re-export to\n\
+another country, of encryption software. BEFORE using any encryption software,\n\
+please check the country's laws, regulations and policies concerning the import,\n\
+possession, or use, and re-export of encryption software, to see if this is\n\
+permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the\n\
+United States, other countries, or both.\n
+########### end of license property ##########################################
\ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/feature.xml
new file mode 100644 (file)
index 0000000..9b8b824
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+      id="org.eclipse.jgit.gpg.bc"
+      label="%featureName"
+      version="5.8.0.qualifier"
+      provider-name="%providerName">
+
+   <description url="http://www.eclipse.org/jgit/">
+      %description
+   </description>
+
+   <copyright>
+      %copyright
+   </copyright>
+
+   <license url="%licenseURL">
+      %license
+   </license>
+
+   <url>
+      <update label="%updateSiteName" url="https://download.eclipse.org/egit/updates"/>
+      <discovery label="%updateSiteName" url="https://download.eclipse.org/egit/updates"/>
+   </url>
+
+   <requires>
+      <import feature="org.eclipse.jgit" version="5.8.0" match="equivalent"/>
+   </requires>
+
+   <plugin
+         id="org.eclipse.jgit.gpg.bc"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.bouncycastle.bcpg"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.bouncycastle.bcpkix"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="org.bouncycastle.bcprov"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+</feature>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/license.html b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/license.html
new file mode 100644 (file)
index 0000000..004b6de
--- /dev/null
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+<body lang="EN-US">
+       <h2>Eclipse Foundation Software User Agreement</h2>
+       <p>November 22, 2017</p>
+       <h3>Usage Of Content</h3>
+       <p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
+               INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+               (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY
+               THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+               CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
+               BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS
+               GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY
+               APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
+               BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
+               AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
+               AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
+               USE THE CONTENT.</p>
+       <h3>Applicable Licenses</h3>
+       <p>
+               Unless otherwise indicated, all Content made available by the Eclipse
+               Foundation is provided to you under the terms and conditions of the
+               Eclipse Public License Version 2.0 (&quot;EPL&quot;). A copy of the
+               EPL is provided with this Content and is also available at <a
+                       href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
+               For purposes of the EPL, &quot;Program&quot; will mean the Content.
+       </p>
+       <p>Content includes, but is not limited to, source code, object
+               code, documentation and other files maintained in the Eclipse
+               Foundation source code repository (&quot;Repository&quot;) in software
+               modules (&quot;Modules&quot;) and made available as downloadable
+               archives (&quot;Downloads&quot;).</p>
+       <ul>
+               <li>Content may be structured and packaged into modules to
+                       facilitate delivering, extending, and upgrading the Content. Typical
+                       modules may include plug-ins (&quot;Plug-ins&quot;), plug-in
+                       fragments (&quot;Fragments&quot;), and features
+                       (&quot;Features&quot;).</li>
+               <li>Each Plug-in or Fragment may be packaged as a sub-directory
+                       or JAR (Java&trade; ARchive) in a directory named
+                       &quot;plugins&quot;.</li>
+               <li>A Feature is a bundle of one or more Plug-ins and/or
+                       Fragments and associated material. Each Feature may be packaged as a
+                       sub-directory in a directory named &quot;features&quot;. Within a
+                       Feature, files named &quot;feature.xml&quot; may contain a list of
+                       the names and version numbers of the Plug-ins and/or Fragments
+                       associated with that Feature.</li>
+               <li>Features may also include other Features (&quot;Included
+                       Features&quot;). Within a Feature, files named
+                       &quot;feature.xml&quot; may contain a list of the names and version
+                       numbers of Included Features.</li>
+       </ul>
+       <p>The terms and conditions governing Plug-ins and Fragments should
+               be contained in files named &quot;about.html&quot;
+               (&quot;Abouts&quot;). The terms and conditions governing Features and
+               Included Features should be contained in files named
+               &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and
+               Feature Licenses may be located in any directory of a Download or
+               Module including, but not limited to the following locations:</p>
+       <ul>
+               <li>The top-level (root) directory</li>
+               <li>Plug-in and Fragment directories</li>
+               <li>Inside Plug-ins and Fragments packaged as JARs</li>
+               <li>Sub-directories of the directory named &quot;src&quot; of
+                       certain Plug-ins</li>
+               <li>Feature directories</li>
+       </ul>
+       <p>Note: if a Feature made available by the Eclipse Foundation is
+               installed using the Provisioning Technology (as defined below), you
+               must agree to a license (&quot;Feature Update License&quot;) during
+               the installation process. If the Feature contains Included Features,
+               the Feature Update License should either provide you with the terms
+               and conditions governing the Included Features or inform you where you
+               can locate them. Feature Update Licenses may be found in the
+               &quot;license&quot; property of files named
+               &quot;feature.properties&quot; found within a Feature. Such Abouts,
+               Feature Licenses, and Feature Update Licenses contain the terms and
+               conditions (or references to such terms and conditions) that govern
+               your use of the associated Content in that directory.</p>
+       <p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY
+               REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND
+               CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT
+               ARE NOT LIMITED TO):</p>
+       <ul>
+               <li>Eclipse Public License Version 1.0 (available at <a
+                       href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>)
+               </li>
+               <li>Eclipse Distribution License Version 1.0 (available at <a
+                       href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)
+               </li>
+               <li>Common Public License Version 1.0 (available at <a
+                       href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)
+               </li>
+               <li>Apache Software License 1.1 (available at <a
+                       href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)
+               </li>
+               <li>Apache Software License 2.0 (available at <a
+                       href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)
+               </li>
+               <li>Mozilla Public License Version 1.1 (available at <a
+                       href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)
+               </li>
+       </ul>
+       <p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
+               CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
+               or Feature Update License is provided, please contact the Eclipse
+               Foundation to determine what terms and conditions govern that
+               particular Content.</p>
+       <h3>Use of Provisioning Technology</h3>
+       <p>
+               The Eclipse Foundation makes available provisioning software, examples
+               of which include, but are not limited to, p2 and the Eclipse Update
+               Manager (&quot;Provisioning Technology&quot;) for the purpose of
+               allowing users to install software, documentation, information and/or
+               other materials (collectively &quot;Installable Software&quot;). This
+               capability is provided with the intent of allowing such users to
+               install, extend and update Eclipse-based products. Information about
+               packaging Installable Software is available at <a
+                       href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+               (&quot;Specification&quot;).
+       </p>
+       <p>You may use Provisioning Technology to allow other parties to
+               install Installable Software. You shall be responsible for enabling
+               the applicable license agreements relating to the Installable Software
+               to be presented to, and accepted by, the users of the Provisioning
+               Technology in accordance with the Specification. By using Provisioning
+               Technology in such a manner and making it available in accordance with
+               the Specification, you further acknowledge your agreement to, and the
+               acquisition of all necessary rights to permit the following:</p>
+       <ol>
+               <li>A series of actions may occur (&quot;Provisioning
+                       Process&quot;) in which a user may execute the Provisioning
+                       Technology on a machine (&quot;Target Machine&quot;) with the intent
+                       of installing, extending or updating the functionality of an
+                       Eclipse-based product.</li>
+               <li>During the Provisioning Process, the Provisioning Technology
+                       may cause third party Installable Software or a portion thereof to be
+                       accessed and copied to the Target Machine.</li>
+               <li>Pursuant to the Specification, you will provide to the user
+                       the terms and conditions that govern the use of the Installable
+                       Software (&quot;Installable Software Agreement&quot;) and such
+                       Installable Software Agreement shall be accessed from the Target
+                       Machine in accordance with the Specification. Such Installable
+                       Software Agreement must inform the user of the terms and conditions
+                       that govern the Installable Software and must solicit acceptance by
+                       the end user in the manner prescribed in such Installable Software
+                       Agreement. Upon such indication of agreement by the user, the
+                       provisioning Technology will complete installation of the Installable
+                       Software.</li>
+       </ol>
+       <h3>Cryptography</h3>
+       <p>Content may contain encryption software. The country in which
+               you are currently may have restrictions on the import, possession, and
+               use, and/or re-export to another country, of encryption software.
+               BEFORE using any encryption software, please check the country's laws,
+               regulations and policies concerning the import, possession, or use,
+               and re-export of encryption software, to see if this is permitted.</p>
+       <p>
+               <small>Java and all Java-based trademarks are trademarks of
+                       Oracle Corporation in the United States, other countries, or both.</small>
+       </p>
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.gpg.bc.feature/pom.xml
new file mode 100644 (file)
index 0000000..c9ada73
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright (C) 2020, Matthias Sohn <matthias.sohn@sap.com> and others
+
+  This program and the accompanying materials are made available under the
+  terms of the Eclipse Distribution License v. 1.0 which is available at
+  http://www.eclipse.org/org/documents/edl-v10.php.
+
+  SPDX-License-Identifier: BSD-3-Clause
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.eclipse.jgit</groupId>
+    <artifactId>jgit.tycho.parent</artifactId>
+    <version>5.8.0-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.eclipse.jgit.feature</groupId>
+  <artifactId>org.eclipse.jgit.gpg.bc</artifactId>
+  <packaging>eclipse-feature</packaging>
+
+  <name>JGit - GPG support using bouncycastle</name>
+  <dependencies>
+
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit.gpg.bc</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+  </dependencies>
+
+</project>
index e2aeee38c63e857d0e563aae1b02b01d7c1c0db9..7aa5c5b05e18e79c1237d8f7d1ccd4b7209a5bca 100644 (file)
@@ -30,6 +30,9 @@
    <bundle id="org.eclipse.jgit.archive" version="0.0.0">
       <category name="JGit-additional-bundles"/>
    </bundle>
+   <feature id="org.eclipse.jgit.gpg.bc" version="0.0.0">
+      <category name="JGit"/>
+   </feature>
    <bundle id="org.eclipse.jgit.ui" version="0.0.0">
       <category name="JGit-additional-bundles"/>
    </bundle>
index 67d1eda22f957b8d8a93bd5a7e23b2b31577c879..b71afc5cd858d77e598cdc1935e2825b1b594459 100644 (file)
       <artifactId>org.eclipse.jgit.archive</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit.gpg.bc</artifactId>
+      <version>${project.version}</version>
+    </dependency>
     <dependency>
       <groupId>org.eclipse.jgit</groupId>
       <artifactId>org.eclipse.jgit.http.apache</artifactId>
index e58d40b32d0f6f9f052282b88871a5222c438bfa..8ac2c631c457b438fb3f404089d1a3de128bf962 100644 (file)
          version="0.0.0"
          unpack="false"/>
 
+   <plugin
+         id="org.eclipse.jgit.gpg.bc.source"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
 </feature>
index 5cbf2aab08a7ca015ee9c8b492c56f391a929727..2f12b50e6d1bb99e24f3929602b3e7ce0b47cf8a 100644 (file)
@@ -41,6 +41,7 @@
   <modules>
     <module>org.eclipse.jgit.target</module>
     <module>org.eclipse.jgit.feature</module>
+    <module>org.eclipse.jgit.gpg.bc.feature</module>
     <module>org.eclipse.jgit.http.apache.feature</module>
     <module>org.eclipse.jgit.ssh.apache.feature</module>
     <module>org.eclipse.jgit.lfs.feature</module>
       <version>${project.version}</version>
       <classifier>sources</classifier>
     </dependency>
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit.gpg.bc</artifactId>
+      <version>${project.version}</version>
+      <classifier>sources</classifier>
+    </dependency>
     <dependency>
       <groupId>org.eclipse.jgit</groupId>
       <artifactId>org.eclipse.jgit.http.apache</artifactId>
index 3ff55e43c7c74eb7d4e8a8b9ca10df5183cff878..490f1c2ea211667fdf3bcabab9b059762d3abd42 100644 (file)
@@ -6,7 +6,10 @@ java_library(
     resource_strip_prefix = "org.eclipse.jgit.pgm/resources",
     resources = glob(["resources/**"]),
     visibility = ["//visibility:public"],
-    runtime_deps = [":services"],
+    runtime_deps = [
+        ":services",
+        "//org.eclipse.jgit.gpg.bc:gpg-bc",
+    ],
     deps = [
         "//lib:args4j",
         "//lib:commons-logging",
index 87baa396ca82499ecb76c8982c425f3429d1ee5f..fb2958478b8761a1927488b4600952bbf016ac5c 100644 (file)
       <version>${project.version}</version>
     </dependency>
 
+    <dependency>
+      <groupId>org.eclipse.jgit</groupId>
+      <artifactId>org.eclipse.jgit.gpg.bc</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
     <dependency>
       <groupId>org.eclipse.jgit</groupId>
       <artifactId>org.eclipse.jgit.http.apache</artifactId>
index b04ac553d18a2261b8d12b83a9de0ab6bd07ad16..cd6195e28766652c9330dfc7fcf4fd5a771d5973 100644 (file)
@@ -74,6 +74,7 @@ java_library(
     resource_strip_prefix = "org.eclipse.jgit.test/resources",
     resources = RESOURCES,
     visibility = [
+        "//org.eclipse.jgit.gpg.bc.test:__pkg__",
         "//org.eclipse.jgit.ssh.apache.test:__pkg__",
     ],
     deps = [
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocatorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocatorTest.java
deleted file mode 100644 (file)
index e93091d..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2019, Thomas Wolf <thomas.wolf@paranor.ch> and others
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Distribution License v. 1.0 which is available at
- * https://www.eclipse.org/org/documents/edl-v10.php.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-package org.eclipse.jgit.lib.internal;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Locale;
-
-import org.junit.Test;
-
-public class BouncyCastleGpgKeyLocatorTest {
-
-       private static final String USER_ID = "Heinrich Heine <heinrichh@uni-duesseldorf.de>";
-
-       private static boolean match(String userId, String pattern) {
-               return BouncyCastleGpgKeyLocator.containsSigningKey(userId, pattern);
-       }
-
-       @Test
-       public void testFullMatch() throws Exception {
-               assertTrue(match(USER_ID,
-                               "=Heinrich Heine <heinrichh@uni-duesseldorf.de>"));
-               assertFalse(match(USER_ID, "=Heinrich Heine"));
-               assertFalse(match(USER_ID, "= "));
-               assertFalse(match(USER_ID, "=heinrichh@uni-duesseldorf.de"));
-       }
-
-       @Test
-       public void testEmpty() throws Exception {
-               assertFalse(match(USER_ID, ""));
-               assertFalse(match(USER_ID, null));
-               assertFalse(match("", ""));
-               assertFalse(match(null, ""));
-               assertFalse(match(null, null));
-               assertFalse(match("", "something"));
-               assertFalse(match(null, "something"));
-       }
-
-       @Test
-       public void testFullEmail() throws Exception {
-               assertTrue(match(USER_ID, "<heinrichh@uni-duesseldorf.de>"));
-               assertTrue(match(USER_ID + " ", "<heinrichh@uni-duesseldorf.de>"));
-               assertFalse(match(USER_ID, "<>"));
-               assertFalse(match(USER_ID, "<h>"));
-               assertFalse(match(USER_ID, "<heinrichh>"));
-               assertFalse(match(USER_ID, "<uni-duesseldorf>"));
-               assertFalse(match(USER_ID, "<h@u>"));
-               assertFalse(match(USER_ID, "<HeinrichH@uni-duesseldorf.de>"));
-               assertFalse(match(USER_ID.substring(0, USER_ID.length() - 1),
-                               "<heinrichh@uni-duesseldorf.de>"));
-               assertFalse(match("", "<>"));
-               assertFalse(match("", "<heinrichh@uni-duesseldorf.de>"));
-       }
-
-       @Test
-       public void testPartialEmail() throws Exception {
-               assertTrue(match(USER_ID, "@heinrichh@uni-duesseldorf.de"));
-               assertTrue(match(USER_ID, "@heinrichh"));
-               assertTrue(match(USER_ID, "@duesseldorf"));
-               assertTrue(match(USER_ID, "@uni-d"));
-               assertTrue(match(USER_ID, "@h"));
-               assertTrue(match(USER_ID, "@."));
-               assertTrue(match(USER_ID, "@h@u"));
-               assertFalse(match(USER_ID, "@ "));
-               assertFalse(match(USER_ID, "@"));
-               assertFalse(match(USER_ID, "@Heine"));
-               assertFalse(match(USER_ID, "@HeinrichH"));
-               assertFalse(match(USER_ID, "@Heinrich"));
-               assertFalse(match("", "@"));
-               assertFalse(match("", "@h"));
-       }
-
-       private void substringTests(String prefix) throws Exception {
-               assertTrue(match(USER_ID, prefix + "heinrichh@uni-duesseldorf.de"));
-               assertTrue(match(USER_ID, prefix + "heinrich"));
-               assertTrue(match(USER_ID, prefix + "HEIN"));
-               assertTrue(match(USER_ID, prefix + "Heine <"));
-               assertTrue(match(USER_ID, prefix + "UNI"));
-               assertTrue(match(USER_ID, prefix + "uni"));
-               assertTrue(match(USER_ID, prefix + "rich He"));
-               assertTrue(match(USER_ID, prefix + "h@u"));
-               assertTrue(match(USER_ID, prefix + USER_ID));
-               assertTrue(match(USER_ID, prefix + USER_ID.toUpperCase(Locale.ROOT)));
-               assertFalse(match(USER_ID, prefix + ""));
-               assertFalse(match(USER_ID, prefix + " "));
-               assertFalse(match(USER_ID, prefix + "yy"));
-               assertFalse(match("", prefix + ""));
-               assertFalse(match("", prefix + "uni"));
-       }
-
-       @Test
-       public void testSubstringPlain() throws Exception {
-               substringTests("");
-       }
-
-       @Test
-       public void testSubstringAsterisk() throws Exception {
-               substringTests("*");
-       }
-
-       @Test
-       public void testExplicitFingerprint() throws Exception {
-               assertFalse(match("John Fade <j.fade@example.com>", "0xfade"));
-               assertFalse(match("John Fade <0xfade@example.com>", "0xfade"));
-               assertFalse(match("", "0xfade"));
-       }
-
-       @Test
-       public void testImplicitFingerprint() throws Exception {
-               assertTrue(match("John Fade <j.fade@example.com>", "fade"));
-               assertTrue(match("John Fade <0xfade@example.com>", "fade"));
-               assertTrue(match("John Fade <j.fade@example.com>", "FADE"));
-               assertTrue(match("John Fade <0xfade@example.com>", "FADE"));
-       }
-
-       @Test
-       public void testZeroX() throws Exception {
-               assertTrue(match("John Fade <0xfade@example.com>", "0x"));
-               assertTrue(match("John Fade <0xfade@example.com>", "*0x"));
-               assertTrue(match("John Fade <0xfade@example.com>", "*0xfade"));
-               assertTrue(match("John Fade <0xfade@example.com>", "*0xFADE"));
-               assertTrue(match("John Fade <0xfade@example.com>", "@0xfade"));
-               assertFalse(match("John Fade <0xfade@example.com>", "@0xFADE"));
-               assertFalse(match("", "0x"));
-       }
-}
index dcfeb1702a5490716e9f57dfb7ace6ce7132753a..19aba5254961e7176fec4905807239a4d1e29a49 100644 (file)
@@ -20,9 +20,6 @@ java_library(
     resources = RESOURCES,
     deps = [
         ":insecure_cipher_factory",
-        "//lib:bcpg",
-        "//lib:bcpkix",
-        "//lib:bcprov",
         "//lib:javaewah",
         "//lib:jsch",
         "//lib:jzlib",
index 1cdb6417b49a5fe86187d4498619657ab0d57483..1479cf99a138041c6a62b6ca35bc1a463aeebaec 100644 (file)
@@ -6,54 +6,56 @@ Bundle-SymbolicName: org.eclipse.jgit
 Bundle-Version: 5.8.0.qualifier
 Bundle-Localization: plugin
 Bundle-Vendor: %Bundle-Vendor
-Bundle-ActivationPolicy: lazy
+Eclipse-ExtensibleAPI: true
 Export-Package: org.eclipse.jgit.annotations;version="5.8.0",
  org.eclipse.jgit.api;version="5.8.0";
-  uses:="org.eclipse.jgit.revwalk,
-   org.eclipse.jgit.treewalk.filter,
-   org.eclipse.jgit.diff,
-   org.eclipse.jgit.util,
+  uses:="org.eclipse.jgit.transport,
    org.eclipse.jgit.notes,
    org.eclipse.jgit.dircache,
-   org.eclipse.jgit.api.errors,
    org.eclipse.jgit.lib,
+   org.eclipse.jgit.revwalk,
+   org.eclipse.jgit.treewalk.filter,
+   org.eclipse.jgit.diff,
    org.eclipse.jgit.treewalk,
-   org.eclipse.jgit.blame,
+   org.eclipse.jgit.util,
    org.eclipse.jgit.submodule,
-   org.eclipse.jgit.transport,
+   org.eclipse.jgit.api.errors,
+   org.eclipse.jgit.revwalk.filter,
+   org.eclipse.jgit.blame,
    org.eclipse.jgit.merge",
  org.eclipse.jgit.api.errors;version="5.8.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.errors",
- org.eclipse.jgit.attributes;version="5.8.0",
+ org.eclipse.jgit.attributes;version="5.8.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.treewalk",
  org.eclipse.jgit.blame;version="5.8.0";
   uses:="org.eclipse.jgit.lib,
    org.eclipse.jgit.revwalk,
    org.eclipse.jgit.treewalk.filter,
    org.eclipse.jgit.diff",
  org.eclipse.jgit.diff;version="5.8.0";
-  uses:="org.eclipse.jgit.patch,
-   org.eclipse.jgit.lib,
-   org.eclipse.jgit.treewalk,
+  uses:="org.eclipse.jgit.lib,
+   org.eclipse.jgit.attributes,
    org.eclipse.jgit.revwalk,
+   org.eclipse.jgit.patch,
    org.eclipse.jgit.treewalk.filter,
+   org.eclipse.jgit.treewalk,
    org.eclipse.jgit.util",
  org.eclipse.jgit.dircache;version="5.8.0";
-  uses:="org.eclipse.jgit.lib,
+  uses:="org.eclipse.jgit.events,
+   org.eclipse.jgit.lib,
+   org.eclipse.jgit.attributes,
    org.eclipse.jgit.treewalk,
-   org.eclipse.jgit.util,
-   org.eclipse.jgit.events,
-   org.eclipse.jgit.attributes",
+   org.eclipse.jgit.util",
  org.eclipse.jgit.errors;version="5.8.0";
-  uses:="org.eclipse.jgit.lib,
-   org.eclipse.jgit.internal.storage.pack,
-   org.eclipse.jgit.transport,
-   org.eclipse.jgit.dircache",
+  uses:="org.eclipse.jgit.transport,
+   org.eclipse.jgit.dircache,
+   org.eclipse.jgit.lib,
+   org.eclipse.jgit.internal.storage.pack",
  org.eclipse.jgit.events;version="5.8.0";uses:="org.eclipse.jgit.lib",
  org.eclipse.jgit.fnmatch;version="5.8.0",
  org.eclipse.jgit.gitrepo;version="5.8.0";
-  uses:="org.eclipse.jgit.api,
+  uses:="org.xml.sax.helpers,
+   org.eclipse.jgit.api,
    org.eclipse.jgit.lib,
    org.eclipse.jgit.revwalk,
-   org.xml.sax.helpers,
    org.xml.sax",
  org.eclipse.jgit.gitrepo.internal;version="5.8.0";x-internal:=true,
  org.eclipse.jgit.hooks;version="5.8.0";uses:="org.eclipse.jgit.lib",
@@ -91,70 +93,91 @@ Export-Package: org.eclipse.jgit.annotations;version="5.8.0",
  org.eclipse.jgit.internal.transport.parser;version="5.8.0";x-friends:="org.eclipse.jgit.http.server,org.eclipse.jgit.test",
  org.eclipse.jgit.internal.transport.ssh;version="5.8.0";x-friends:="org.eclipse.jgit.ssh.apache",
  org.eclipse.jgit.lib;version="5.8.0";
-  uses:="org.eclipse.jgit.revwalk,
-   org.eclipse.jgit.treewalk.filter,
-   org.eclipse.jgit.util,
-   org.eclipse.jgit.events,
+  uses:="org.eclipse.jgit.transport,
+   org.eclipse.jgit.util.sha1,
    org.eclipse.jgit.dircache,
+   org.eclipse.jgit.revwalk,
    org.eclipse.jgit.internal.storage.file,
+   org.eclipse.jgit.attributes,
+   org.eclipse.jgit.events,
+   com.googlecode.javaewah,
+   org.eclipse.jgit.treewalk.filter,
    org.eclipse.jgit.treewalk,
-   org.eclipse.jgit.transport,
-   org.eclipse.jgit.submodule",
+   org.eclipse.jgit.util,
+   org.eclipse.jgit.submodule,
+   org.eclipse.jgit.util.time",
  org.eclipse.jgit.lib.internal;version="5.8.0";x-friends:="org.eclipse.jgit.test",
  org.eclipse.jgit.merge;version="5.8.0";
-  uses:="org.eclipse.jgit.lib,
-   org.eclipse.jgit.treewalk,
+  uses:="org.eclipse.jgit.dircache,
+   org.eclipse.jgit.lib,
    org.eclipse.jgit.revwalk,
    org.eclipse.jgit.diff,
-   org.eclipse.jgit.dircache,
-   org.eclipse.jgit.api",
+   org.eclipse.jgit.treewalk,
+   org.eclipse.jgit.util,
+   org.eclipse.jgit.api,
+   org.eclipse.jgit.attributes",
  org.eclipse.jgit.nls;version="5.8.0",
  org.eclipse.jgit.notes;version="5.8.0";
   uses:="org.eclipse.jgit.lib,
-   org.eclipse.jgit.treewalk,
    org.eclipse.jgit.revwalk,
+   org.eclipse.jgit.treewalk,
    org.eclipse.jgit.merge",
  org.eclipse.jgit.patch;version="5.8.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.diff",
  org.eclipse.jgit.revplot;version="5.8.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.revwalk",
  org.eclipse.jgit.revwalk;version="5.8.0";
   uses:="org.eclipse.jgit.lib,
-   org.eclipse.jgit.treewalk,
-   org.eclipse.jgit.treewalk.filter,
    org.eclipse.jgit.diff,
-   org.eclipse.jgit.revwalk.filter",
+   org.eclipse.jgit.treewalk.filter,
+   org.eclipse.jgit.revwalk.filter,
+   org.eclipse.jgit.treewalk",
  org.eclipse.jgit.revwalk.filter;version="5.8.0";uses:="org.eclipse.jgit.revwalk,org.eclipse.jgit.lib,org.eclipse.jgit.util",
  org.eclipse.jgit.storage.file;version="5.8.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.util",
  org.eclipse.jgit.storage.pack;version="5.8.0";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.submodule;version="5.8.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.treewalk.filter,org.eclipse.jgit.treewalk",
+ org.eclipse.jgit.submodule;version="5.8.0";
+  uses:="org.eclipse.jgit.lib,
+   org.eclipse.jgit.diff,
+   org.eclipse.jgit.treewalk.filter,
+   org.eclipse.jgit.treewalk,
+   org.eclipse.jgit.util",
  org.eclipse.jgit.transport;version="5.8.0";
-  uses:="org.eclipse.jgit.transport.resolver,
-   org.eclipse.jgit.revwalk,
-   org.eclipse.jgit.internal.storage.pack,
-   com.jcraft.jsch,
-   org.eclipse.jgit.util,
+  uses:="javax.crypto,
    org.eclipse.jgit.util.io,
-   org.eclipse.jgit.internal.storage.file,
-   org.eclipse.jgit.internal.transport.parser,
    org.eclipse.jgit.lib,
+   org.eclipse.jgit.revwalk,
    org.eclipse.jgit.transport.http,
+   org.eclipse.jgit.internal.storage.file,
+   org.eclipse.jgit.treewalk,
+   org.eclipse.jgit.internal.transport.ssh,
+   org.eclipse.jgit.util,
+   org.eclipse.jgit.internal.storage.pack,
+   org.eclipse.jgit.transport.resolver,
+   org.eclipse.jgit.storage.pack,
    org.eclipse.jgit.errors,
-   org.eclipse.jgit.storage.pack",
+   com.jcraft.jsch",
  org.eclipse.jgit.transport.http;version="5.8.0";uses:="javax.net.ssl",
- org.eclipse.jgit.transport.resolver;version="5.8.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.transport",
+ org.eclipse.jgit.transport.resolver;version="5.8.0";uses:="org.eclipse.jgit.transport,org.eclipse.jgit.lib",
  org.eclipse.jgit.treewalk;version="5.8.0";
-  uses:="org.eclipse.jgit.lib,
-   org.eclipse.jgit.revwalk,
+  uses:="org.eclipse.jgit.dircache,
+   org.eclipse.jgit.lib,
    org.eclipse.jgit.attributes,
+   org.eclipse.jgit.revwalk,
    org.eclipse.jgit.treewalk.filter,
-   org.eclipse.jgit.util,
-   org.eclipse.jgit.dircache",
+   org.eclipse.jgit.util",
  org.eclipse.jgit.treewalk.filter;version="5.8.0";uses:="org.eclipse.jgit.treewalk",
  org.eclipse.jgit.util;version="5.8.0";
-  uses:="org.eclipse.jgit.lib,
-   org.eclipse.jgit.transport.http,
+  uses:="org.eclipse.jgit.transport,
+   org.eclipse.jgit.hooks,
+   org.eclipse.jgit.revwalk,
    org.eclipse.jgit.storage.file,
-   org.ietf.jgss",
- org.eclipse.jgit.util.io;version="5.8.0",
+   org.ietf.jgss,
+   org.eclipse.jgit.attributes,
+   javax.management,
+   org.eclipse.jgit.lib,
+   org.eclipse.jgit.transport.http,
+   org.eclipse.jgit.treewalk,
+   javax.net.ssl,
+   org.eclipse.jgit.util.time",
+ org.eclipse.jgit.util.io;version="5.8.0";uses:="org.eclipse.jgit.attributes,org.eclipse.jgit.lib,org.eclipse.jgit.treewalk",
  org.eclipse.jgit.util.sha1;version="5.8.0",
  org.eclipse.jgit.util.time;version="5.8.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -162,17 +185,6 @@ Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)",
  com.jcraft.jsch;version="[0.1.37,0.2.0)",
  javax.crypto,
  javax.net.ssl,
- org.bouncycastle;version="[1.65.0,2.0.0)",
- org.bouncycastle.bcpg;version="[1.65.0,2.0.0)",
- org.bouncycastle.gpg;version="[1.65.0,2.0.0)",
- org.bouncycastle.gpg.keybox;version="[1.65.0,2.0.0)",
- org.bouncycastle.gpg.keybox.jcajce;version="[1.65.0,2.0.0)",
- org.bouncycastle.jce.provider;version="[1.65.0,2.0.0)",
- org.bouncycastle.openpgp;version="[1.65.0,2.0.0)",
- org.bouncycastle.openpgp.jcajce;version="[1.65.0,2.0.0)",
- org.bouncycastle.openpgp.operator;version="[1.65.0,2.0.0)",
- org.bouncycastle.openpgp.operator.jcajce;version="[1.65.0,2.0.0)",
- org.bouncycastle.util.encoders;version="[1.65.0,2.0.0)",
  org.slf4j;version="[1.7.0,2.0.0)",
  org.xml.sax,
  org.xml.sax.helpers
index e87fa2ed72c861105b7e0e23b10885e4cfc39c57..025ab82a05da2c63e7080dcbeccc304b0d9727ff 100644 (file)
       <artifactId>slf4j-api</artifactId>
     </dependency>
 
-    <dependency>
-      <groupId>org.bouncycastle</groupId>
-      <artifactId>bcpg-jdk15on</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.bouncycastle</groupId>
-      <artifactId>bcprov-jdk15on</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.bouncycastle</groupId>
-      <artifactId>bcpkix-jdk15on</artifactId>
-    </dependency>
-
   </dependencies>
 
   <build>
                   <breakBuildOnBinaryIncompatibleModifications>false</breakBuildOnBinaryIncompatibleModifications>
                   <onlyBinaryIncompatible>false</onlyBinaryIncompatible>
                   <includeSynthetic>false</includeSynthetic>
-                  <ignoreMissingClasses>false</ignoreMissingClasses>
+                  <ignoreMissingClasses>true</ignoreMissingClasses>
                   <skipPomModules>true</skipPomModules>
               </parameter>
               <skip>false</skip>
                   <breakBuildOnBinaryIncompatibleModifications>false</breakBuildOnBinaryIncompatibleModifications>
                   <onlyBinaryIncompatible>false</onlyBinaryIncompatible>
                   <includeSynthetic>false</includeSynthetic>
-                  <ignoreMissingClasses>false</ignoreMissingClasses>
+                  <ignoreMissingClasses>true</ignoreMissingClasses>
                   <skipPomModules>true</skipPomModules>
               </parameter>
               <skip>false</skip>
index 9dd6320933d062ab6d65c3141068212dba846492..c6e62b44046c9a4c63b3d5674d6756d56cb6d0e3 100644 (file)
@@ -305,15 +305,6 @@ flagsAlreadyCreated={0} flags already created.
 funnyRefname=funny refname
 gcFailed=Garbage collection failed.
 gcTooManyUnpruned=Too many loose, unpruneable objects after garbage collection. Consider adjusting gc.auto or gc.pruneExpire.
-gpgFailedToParseSecretKey=Failed to parse secret key file in directory: {0}. Is the entered passphrase correct?
-gpgNoCredentialsProvider=missing credentials provider
-gpgNoKeyring=neither pubring.kbx nor secring.gpg files found
-gpgNoKeyInLegacySecring=no matching secret key found in legacy secring.gpg for key or user id: {0}
-gpgNoPublicKeyFound=Unable to find a public-key with key or user id: {0}
-gpgNoSecretKeyForPublicKey=unable to find associated secret key for public key: {0}
-gpgNotASigningKey=Secret key ({0}) is not suitable for signing
-gpgKeyInfo=GPG Key (fingerprint {0})
-gpgSigningCancelled=Signing was cancelled
 headRequiredToStash=HEAD required to stash local changes
 hoursAgo={0} hours ago
 httpConfigCannotNormalizeURL=Cannot normalize URL path {0}: too many .. segments
@@ -619,6 +610,7 @@ shortReadOfBlock=Short read of block.
 shortReadOfOptionalDIRCExtensionExpectedAnotherBytes=Short read of optional DIRC extension {0}; expected another {1} bytes within the section.
 shortSkipOfBlock=Short skip of block.
 signingNotSupportedOnTag=Signing isn't supported on tag operations yet.
+signingServiceUnavailable=Signing service is not available
 similarityScoreMustBeWithinBounds=Similarity score must be between 0 and 100.
 skipMustBeNonNegative=skip must be >= 0
 skipNotAccessiblePath=The path ''{0}'' isn't accessible. Skip it.
index 4e18b5994d18990b313556ca49b4954ee94bcd62..b4f717503649b51b261afb4cecd407bed3d846ef 100644 (file)
@@ -27,6 +27,7 @@ import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.api.errors.NoFilepatternException;
 import org.eclipse.jgit.api.errors.NoHeadException;
 import org.eclipse.jgit.api.errors.NoMessageException;
+import org.eclipse.jgit.api.errors.ServiceUnavailableException;
 import org.eclipse.jgit.api.errors.UnmergedPathsException;
 import org.eclipse.jgit.api.errors.UnsupportedSigningFormatException;
 import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
@@ -55,7 +56,6 @@ import org.eclipse.jgit.lib.RefUpdate;
 import org.eclipse.jgit.lib.RefUpdate.Result;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.RepositoryState;
-import org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner;
 import org.eclipse.jgit.revwalk.RevCommit;
 import org.eclipse.jgit.revwalk.RevObject;
 import org.eclipse.jgit.revwalk.RevTag;
@@ -140,12 +140,16 @@ public class CommitCommand extends GitCommand<RevCommit> {
         * collected by the setter methods of this class. Each instance of this
         * class should only be used for one invocation of the command (means: one
         * call to {@link #call()})
+        *
+        * @throws ServiceUnavailableException
+        *             if signing service is not available e.g. since it isn't
+        *             installed
         */
        @Override
-       public RevCommit call() throws GitAPIException, NoHeadException,
-                       NoMessageException, UnmergedPathsException,
-                       ConcurrentRefUpdateException, WrongRepositoryStateException,
-                       AbortedByHookException {
+       public RevCommit call() throws GitAPIException, AbortedByHookException,
+                       ConcurrentRefUpdateException, NoHeadException, NoMessageException,
+                       ServiceUnavailableException, UnmergedPathsException,
+                       WrongRepositoryStateException {
                checkCallable();
                Collections.sort(only);
 
@@ -239,6 +243,10 @@ public class CommitCommand extends GitCommand<RevCommit> {
                                commit.setTreeId(indexTreeId);
 
                                if (signCommit.booleanValue()) {
+                                       if (gpgSigner == null) {
+                                               throw new ServiceUnavailableException(
+                                                               JGitText.get().signingServiceUnavailable);
+                                       }
                                        gpgSigner.sign(commit, signingKey, committer,
                                                        credentialsProvider);
                                }
@@ -510,7 +518,8 @@ public class CommitCommand extends GitCommand<RevCommit> {
         *
         * @throws NoMessageException
         *             if the commit message has not been specified
-        * @throws UnsupportedSigningFormatException if the configured gpg.format is not supported
+        * @throws UnsupportedSigningFormatException
+        *             if the configured gpg.format is not supported
         */
        private void processOptions(RepositoryState state, RevWalk rw)
                        throws NoMessageException, UnsupportedSigningFormatException {
@@ -581,9 +590,6 @@ public class CommitCommand extends GitCommand<RevCommit> {
                                                JGitText.get().onlyOpenPgpSupportedForSigning);
                        }
                        gpgSigner = GpgSigner.getDefault();
-                       if (gpgSigner == null) {
-                               gpgSigner = new BouncyCastleGpgSigner();
-                       }
                }
        }
 
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ServiceUnavailableException.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/ServiceUnavailableException.java
new file mode 100644 (file)
index 0000000..207ded0
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020, Matthias Sohn <matthias.sohn@sap.com> and
+ * other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.api.errors;
+
+/**
+ * Exception thrown when an optional service is not available
+ *
+ * @since 5.8
+ */
+public class ServiceUnavailableException extends GitAPIException {
+       private static final long serialVersionUID = 1L;
+
+       /**
+        * Constructor for ServiceUnavailableException
+        *
+        * @param message
+        *            error message
+        * @param cause
+        *            a {@link java.lang.Throwable}
+        */
+       public ServiceUnavailableException(String message, Throwable cause) {
+               super(message, cause);
+       }
+
+       /**
+        * Constructor for ServiceUnavailableException
+        *
+        * @param message
+        *            error message
+        */
+       public ServiceUnavailableException(String message) {
+               super(message);
+       }
+}
index f18ecb92180ae5ce768d52b768d1871ec66aa63e..9d122ba12f6bb470f2bf3e79cc48246422688e9c 100644 (file)
@@ -333,15 +333,6 @@ public class JGitText extends TranslationBundle {
        /***/ public String funnyRefname;
        /***/ public String gcFailed;
        /***/ public String gcTooManyUnpruned;
-       /***/ public String gpgFailedToParseSecretKey;
-       /***/ public String gpgNoCredentialsProvider;
-       /***/ public String gpgNoKeyring;
-       /***/ public String gpgNoKeyInLegacySecring;
-       /***/ public String gpgNoPublicKeyFound;
-       /***/ public String gpgNoSecretKeyForPublicKey;
-       /***/ public String gpgNotASigningKey;
-       /***/ public String gpgKeyInfo;
-       /***/ public String gpgSigningCancelled;
        /***/ public String headRequiredToStash;
        /***/ public String hoursAgo;
        /***/ public String httpConfigCannotNormalizeURL;
@@ -647,6 +638,7 @@ public class JGitText extends TranslationBundle {
        /***/ public String shortReadOfOptionalDIRCExtensionExpectedAnotherBytes;
        /***/ public String shortSkipOfBlock;
        /***/ public String signingNotSupportedOnTag;
+       /***/ public String signingServiceUnavailable;
        /***/ public String similarityScoreMustBeWithinBounds;
        /***/ public String skipMustBeNonNegative;
        /***/ public String skipNotAccessiblePath;
index d953a0194567555de5862ffb27d7816acd73db97..5b32cf0b5fab80c1a949f4c833356b90f2d13f12 100644 (file)
@@ -9,11 +9,16 @@
  */
 package org.eclipse.jgit.lib;
 
+import java.util.Iterator;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
+
 import org.eclipse.jgit.annotations.NonNull;
 import org.eclipse.jgit.annotations.Nullable;
 import org.eclipse.jgit.api.errors.CanceledException;
-import org.eclipse.jgit.lib.internal.BouncyCastleGpgSigner;
 import org.eclipse.jgit.transport.CredentialsProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Creates GPG signatures for Git objects.
@@ -21,8 +26,23 @@ import org.eclipse.jgit.transport.CredentialsProvider;
  * @since 5.3
  */
 public abstract class GpgSigner {
+       private static final Logger LOG = LoggerFactory.getLogger(GpgSigner.class);
+
+       private static GpgSigner defaultSigner = loadGpgSigner();
 
-       private static GpgSigner defaultSigner = new BouncyCastleGpgSigner();
+       private static GpgSigner loadGpgSigner() {
+               try {
+                       ServiceLoader<GpgSigner> loader = ServiceLoader
+                                       .load(GpgSigner.class);
+                       Iterator<GpgSigner> iter = loader.iterator();
+                       if (iter.hasNext()) {
+                               return iter.next();
+                       }
+               } catch (ServiceConfigurationError e) {
+                       LOG.error(e.getMessage(), e);
+               }
+               return null;
+       }
 
        /**
         * Get the default signer, or <code>null</code>.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKey.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKey.java
deleted file mode 100644 (file)
index 8601d7c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2018, Salesforce. and others
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Distribution License v. 1.0 which is available at
- * https://www.eclipse.org/org/documents/edl-v10.php.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-package org.eclipse.jgit.lib.internal;
-
-import java.nio.file.Path;
-
-import org.bouncycastle.openpgp.PGPSecretKey;
-
-/**
- * Container which holds a {@link #getSecretKey()} together with the
- * {@link #getOrigin() path it was loaded from}.
- */
-class BouncyCastleGpgKey {
-
-       private PGPSecretKey secretKey;
-
-       private Path origin;
-
-       public BouncyCastleGpgKey(PGPSecretKey secretKey, Path origin) {
-               this.secretKey = secretKey;
-               this.origin = origin;
-       }
-
-       public PGPSecretKey getSecretKey() {
-               return secretKey;
-       }
-
-       public Path getOrigin() {
-               return origin;
-       }
-}
\ No newline at end of file
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java
deleted file mode 100644 (file)
index 8a32299..0000000
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
- * Copyright (C) 2018, Salesforce. and others
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Distribution License v. 1.0 which is available at
- * https://www.eclipse.org/org/documents/edl-v10.php.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-package org.eclipse.jgit.lib.internal;
-
-import static java.nio.file.Files.exists;
-import static java.nio.file.Files.newInputStream;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.nio.file.DirectoryStream;
-import java.nio.file.Files;
-import java.nio.file.InvalidPathException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import org.bouncycastle.gpg.SExprParser;
-import org.bouncycastle.gpg.keybox.BlobType;
-import org.bouncycastle.gpg.keybox.KeyBlob;
-import org.bouncycastle.gpg.keybox.KeyBox;
-import org.bouncycastle.gpg.keybox.KeyInformation;
-import org.bouncycastle.gpg.keybox.PublicKeyRingBlob;
-import org.bouncycastle.gpg.keybox.UserID;
-import org.bouncycastle.gpg.keybox.jcajce.JcaKeyBoxBuilder;
-import org.bouncycastle.openpgp.PGPException;
-import org.bouncycastle.openpgp.PGPKeyFlags;
-import org.bouncycastle.openpgp.PGPPublicKey;
-import org.bouncycastle.openpgp.PGPPublicKeyRing;
-import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
-import org.bouncycastle.openpgp.PGPSecretKey;
-import org.bouncycastle.openpgp.PGPSecretKeyRing;
-import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
-import org.bouncycastle.openpgp.PGPSignature;
-import org.bouncycastle.openpgp.PGPUtil;
-import org.bouncycastle.openpgp.operator.PBEProtectionRemoverFactory;
-import org.bouncycastle.openpgp.operator.PGPDigestCalculatorProvider;
-import org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
-import org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder;
-import org.bouncycastle.openpgp.operator.jcajce.JcePBEProtectionRemoverFactory;
-import org.bouncycastle.util.encoders.Hex;
-import org.eclipse.jgit.annotations.NonNull;
-import org.eclipse.jgit.api.errors.CanceledException;
-import org.eclipse.jgit.errors.UnsupportedCredentialItem;
-import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.util.FS;
-import org.eclipse.jgit.util.StringUtils;
-import org.eclipse.jgit.util.SystemReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Locates GPG keys from either <code>~/.gnupg/private-keys-v1.d</code> or
- * <code>~/.gnupg/secring.gpg</code>
- */
-class BouncyCastleGpgKeyLocator {
-
-       /** Thrown if a keybox file exists but doesn't contain an OpenPGP key. */
-       private static class NoOpenPgpKeyException extends Exception {
-
-               private static final long serialVersionUID = 1L;
-
-       }
-
-       private static final Logger log = LoggerFactory
-                       .getLogger(BouncyCastleGpgKeyLocator.class);
-
-       private static final Path GPG_DIRECTORY = findGpgDirectory();
-
-       private static final Path USER_KEYBOX_PATH = GPG_DIRECTORY
-                       .resolve("pubring.kbx"); //$NON-NLS-1$
-
-       private static final Path USER_SECRET_KEY_DIR = GPG_DIRECTORY
-                       .resolve("private-keys-v1.d"); //$NON-NLS-1$
-
-       private static final Path USER_PGP_PUBRING_FILE = GPG_DIRECTORY
-                       .resolve("pubring.gpg"); //$NON-NLS-1$
-
-       private static final Path USER_PGP_LEGACY_SECRING_FILE = GPG_DIRECTORY
-                       .resolve("secring.gpg"); //$NON-NLS-1$
-
-       private final String signingKey;
-
-       private BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt;
-
-       private static Path findGpgDirectory() {
-               SystemReader system = SystemReader.getInstance();
-               if (system.isWindows()) {
-                       // On Windows prefer %APPDATA%\gnupg if it exists, even if Cygwin is
-                       // used.
-                       String appData = system.getenv("APPDATA"); //$NON-NLS-1$
-                       if (appData != null && !appData.isEmpty()) {
-                               try {
-                                       Path directory = Paths.get(appData).resolve("gnupg"); //$NON-NLS-1$
-                                       if (Files.isDirectory(directory)) {
-                                               return directory;
-                                       }
-                               } catch (SecurityException | InvalidPathException e) {
-                                       // Ignore and return the default location below.
-                               }
-                       }
-               }
-               // All systems, including Cygwin and even Windows if
-               // %APPDATA%\gnupg doesn't exist: ~/.gnupg
-               File home = FS.DETECTED.userHome();
-               if (home == null) {
-                       // Oops. What now?
-                       home = new File(".").getAbsoluteFile(); //$NON-NLS-1$
-               }
-               return home.toPath().resolve(".gnupg"); //$NON-NLS-1$
-       }
-
-       /**
-        * Create a new key locator for the specified signing key.
-        * <p>
-        * The signing key must either be a hex representation of a specific key or
-        * a user identity substring (eg., email address). All keys in the KeyBox
-        * will be looked up in the order as returned by the KeyBox. A key id will
-        * be searched before attempting to find a key by user id.
-        * </p>
-        *
-        * @param signingKey
-        *            the signing key to search for
-        * @param passphrasePrompt
-        *            the provider to use when asking for key passphrase
-        */
-       public BouncyCastleGpgKeyLocator(String signingKey,
-                       @NonNull BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt) {
-               this.signingKey = signingKey;
-               this.passphrasePrompt = passphrasePrompt;
-       }
-
-       private PGPSecretKey attemptParseSecretKey(Path keyFile,
-                       PGPDigestCalculatorProvider calculatorProvider,
-                       PBEProtectionRemoverFactory passphraseProvider,
-                       PGPPublicKey publicKey) {
-               try (InputStream in = newInputStream(keyFile)) {
-                       return new SExprParser(calculatorProvider).parseSecretKey(
-                                       new BufferedInputStream(in), passphraseProvider, publicKey);
-               } catch (IOException | PGPException | ClassCastException e) {
-                       if (log.isDebugEnabled())
-                               log.debug("Ignoring unreadable file '{}': {}", keyFile, //$NON-NLS-1$
-                                               e.getMessage(), e);
-                       return null;
-               }
-       }
-
-       /**
-        * Checks whether a given OpenPGP {@code userId} matches a given
-        * {@code signingKeySpec}, which is supposed to have one of the formats
-        * defined by GPG.
-        * <p>
-        * Not all formats are supported; only formats starting with '=', '&lt;',
-        * '@', and '*' are handled. Any other format results in a case-insensitive
-        * substring match.
-        * </p>
-        *
-        * @param userId
-        *            of a key
-        * @param signingKeySpec
-        *            GPG key identification
-        * @return whether the {@code userId} matches
-        * @see <a href=
-        *      "https://www.gnupg.org/documentation/manuals/gnupg/Specify-a-User-ID.html">GPG
-        *      Documentation: How to Specify a User ID</a>
-        */
-       static boolean containsSigningKey(String userId, String signingKeySpec) {
-               if (StringUtils.isEmptyOrNull(userId)
-                               || StringUtils.isEmptyOrNull(signingKeySpec)) {
-                       return false;
-               }
-               String toMatch = signingKeySpec;
-               if (toMatch.startsWith("0x") && toMatch.trim().length() > 2) { //$NON-NLS-1$
-                       return false; // Explicit fingerprint
-               }
-               int command = toMatch.charAt(0);
-               switch (command) {
-               case '=':
-               case '<':
-               case '@':
-               case '*':
-                       toMatch = toMatch.substring(1);
-                       if (toMatch.isEmpty()) {
-                               return false;
-                       }
-                       break;
-               default:
-                       break;
-               }
-               switch (command) {
-               case '=':
-                       return userId.equals(toMatch);
-               case '<': {
-                       int begin = userId.indexOf('<');
-                       int end = userId.indexOf('>', begin + 1);
-                       int stop = toMatch.indexOf('>');
-                       return begin >= 0 && end > begin + 1 && stop > 0
-                                       && userId.substring(begin + 1, end)
-                                                       .equals(toMatch.substring(0, stop));
-               }
-               case '@': {
-                       int begin = userId.indexOf('<');
-                       int end = userId.indexOf('>', begin + 1);
-                       return begin >= 0 && end > begin + 1
-                                       && userId.substring(begin + 1, end).contains(toMatch);
-               }
-               default:
-                       if (toMatch.trim().isEmpty()) {
-                               return false;
-                       }
-                       return userId.toLowerCase(Locale.ROOT)
-                                       .contains(toMatch.toLowerCase(Locale.ROOT));
-               }
-       }
-
-       private String toFingerprint(String keyId) {
-               if (keyId.startsWith("0x")) { //$NON-NLS-1$
-                       return keyId.substring(2);
-               }
-               return keyId;
-       }
-
-       private PGPPublicKey findPublicKeyByKeyId(KeyBlob keyBlob)
-                       throws IOException {
-               String keyId = toFingerprint(signingKey).toLowerCase(Locale.ROOT);
-               if (keyId.isEmpty()) {
-                       return null;
-               }
-               for (KeyInformation keyInfo : keyBlob.getKeyInformation()) {
-                       String fingerprint = Hex.toHexString(keyInfo.getFingerprint())
-                                       .toLowerCase(Locale.ROOT);
-                       if (fingerprint.endsWith(keyId)) {
-                               return getPublicKey(keyBlob, keyInfo.getFingerprint());
-                       }
-               }
-               return null;
-       }
-
-       private PGPPublicKey findPublicKeyByUserId(KeyBlob keyBlob)
-                       throws IOException {
-               for (UserID userID : keyBlob.getUserIds()) {
-                       if (containsSigningKey(userID.getUserIDAsString(), signingKey)) {
-                               return getSigningPublicKey(keyBlob);
-                       }
-               }
-               return null;
-       }
-
-       /**
-        * Finds a public key associated with the signing key.
-        *
-        * @param keyboxFile
-        *            the KeyBox file
-        * @return publicKey the public key (maybe <code>null</code>)
-        * @throws IOException
-        *             in case of problems reading the file
-        * @throws NoSuchAlgorithmException
-        * @throws NoSuchProviderException
-        * @throws NoOpenPgpKeyException
-        *             if the file does not contain any OpenPGP key
-        */
-       private PGPPublicKey findPublicKeyInKeyBox(Path keyboxFile)
-                       throws IOException, NoSuchAlgorithmException,
-                       NoSuchProviderException, NoOpenPgpKeyException {
-               KeyBox keyBox = readKeyBoxFile(keyboxFile);
-               boolean hasOpenPgpKey = false;
-               for (KeyBlob keyBlob : keyBox.getKeyBlobs()) {
-                       if (keyBlob.getType() == BlobType.OPEN_PGP_BLOB) {
-                               hasOpenPgpKey = true;
-                               PGPPublicKey key = findPublicKeyByKeyId(keyBlob);
-                               if (key != null) {
-                                       return key;
-                               }
-                               key = findPublicKeyByUserId(keyBlob);
-                               if (key != null) {
-                                       return key;
-                               }
-                       }
-               }
-               if (!hasOpenPgpKey) {
-                       throw new NoOpenPgpKeyException();
-               }
-               return null;
-       }
-
-       /**
-        * If there is a private key directory containing keys, use pubring.kbx or
-        * pubring.gpg to find the public key; then try to find the secret key in
-        * the directory.
-        * <p>
-        * If there is no private key directory (or it doesn't contain any keys),
-        * try to find the key in secring.gpg directly.
-        * </p>
-        *
-        * @return the secret key
-        * @throws IOException
-        *             in case of issues reading key files
-        * @throws NoSuchAlgorithmException
-        * @throws NoSuchProviderException
-        * @throws PGPException
-        *             in case of issues finding a key, including no key found
-        * @throws CanceledException
-        * @throws URISyntaxException
-        * @throws UnsupportedCredentialItem
-        */
-       @NonNull
-       public BouncyCastleGpgKey findSecretKey() throws IOException,
-                       NoSuchAlgorithmException, NoSuchProviderException, PGPException,
-                       CanceledException, UnsupportedCredentialItem, URISyntaxException {
-               BouncyCastleGpgKey key;
-               PGPPublicKey publicKey = null;
-               if (hasKeyFiles(USER_SECRET_KEY_DIR)) {
-                       // Use pubring.kbx or pubring.gpg to find the public key, then try
-                       // the key files in the directory. If the public key was found in
-                       // pubring.gpg also try secring.gpg to find the secret key.
-                       if (exists(USER_KEYBOX_PATH)) {
-                               try {
-                                       publicKey = findPublicKeyInKeyBox(USER_KEYBOX_PATH);
-                                       if (publicKey != null) {
-                                               key = findSecretKeyForKeyBoxPublicKey(publicKey,
-                                                               USER_KEYBOX_PATH);
-                                               if (key != null) {
-                                                       return key;
-                                               }
-                                               throw new PGPException(MessageFormat.format(
-                                                               JGitText.get().gpgNoSecretKeyForPublicKey,
-                                                               Long.toHexString(publicKey.getKeyID())));
-                                       }
-                                       throw new PGPException(MessageFormat.format(
-                                                       JGitText.get().gpgNoPublicKeyFound, signingKey));
-                               } catch (NoOpenPgpKeyException e) {
-                                       // There are no OpenPGP keys in the keybox at all: try the
-                                       // pubring.gpg, if it exists.
-                                       if (log.isDebugEnabled()) {
-                                               log.debug("{} does not contain any OpenPGP keys", //$NON-NLS-1$
-                                                               USER_KEYBOX_PATH);
-                                       }
-                               }
-                       }
-                       if (exists(USER_PGP_PUBRING_FILE)) {
-                               publicKey = findPublicKeyInPubring(USER_PGP_PUBRING_FILE);
-                               if (publicKey != null) {
-                                       // GPG < 2.1 may have both; the agent using the directory
-                                       // and gpg using secring.gpg. GPG >= 2.1 delegates all
-                                       // secret key handling to the agent and doesn't use
-                                       // secring.gpg at all, even if it exists. Which means for us
-                                       // we have to try both since we don't know which GPG version
-                                       // the user has.
-                                       key = findSecretKeyForKeyBoxPublicKey(publicKey,
-                                                       USER_PGP_PUBRING_FILE);
-                                       if (key != null) {
-                                               return key;
-                                       }
-                               }
-                       }
-                       if (publicKey == null) {
-                               throw new PGPException(MessageFormat.format(
-                                               JGitText.get().gpgNoPublicKeyFound, signingKey));
-                       }
-                       // We found a public key, but didn't find the secret key in the
-                       // private key directory. Go try the secring.gpg.
-               }
-               boolean hasSecring = false;
-               if (exists(USER_PGP_LEGACY_SECRING_FILE)) {
-                       hasSecring = true;
-                       key = loadKeyFromSecring(USER_PGP_LEGACY_SECRING_FILE);
-                       if (key != null) {
-                               return key;
-                       }
-               }
-               if (publicKey != null) {
-                       throw new PGPException(MessageFormat.format(
-                                       JGitText.get().gpgNoSecretKeyForPublicKey,
-                                       Long.toHexString(publicKey.getKeyID())));
-               } else if (hasSecring) {
-                       // publicKey == null: user has _only_ pubring.gpg/secring.gpg.
-                       throw new PGPException(MessageFormat.format(
-                                       JGitText.get().gpgNoKeyInLegacySecring, signingKey));
-               } else {
-                       throw new PGPException(JGitText.get().gpgNoKeyring);
-               }
-       }
-
-       private boolean hasKeyFiles(Path dir) {
-               try (DirectoryStream<Path> contents = Files.newDirectoryStream(dir,
-                               "*.key")) { //$NON-NLS-1$
-                       return contents.iterator().hasNext();
-               } catch (IOException e) {
-                       // Not a directory, or something else
-                       return false;
-               }
-       }
-
-       private BouncyCastleGpgKey loadKeyFromSecring(Path secring)
-                       throws IOException, PGPException {
-               PGPSecretKey secretKey = findSecretKeyInLegacySecring(signingKey,
-                               secring);
-
-               if (secretKey != null) {
-                       if (!secretKey.isSigningKey()) {
-                               throw new PGPException(MessageFormat
-                                               .format(JGitText.get().gpgNotASigningKey, signingKey));
-                       }
-                       return new BouncyCastleGpgKey(secretKey, secring);
-               }
-               return null;
-       }
-
-       private BouncyCastleGpgKey findSecretKeyForKeyBoxPublicKey(
-                       PGPPublicKey publicKey, Path userKeyboxPath)
-                       throws PGPException, CanceledException, UnsupportedCredentialItem,
-                       URISyntaxException {
-               /*
-                * this is somewhat brute-force but there doesn't seem to be another
-                * way; we have to walk all private key files we find and try to open
-                * them
-                */
-
-               PGPDigestCalculatorProvider calculatorProvider = new JcaPGPDigestCalculatorProviderBuilder()
-                               .build();
-
-               PBEProtectionRemoverFactory passphraseProvider = new JcePBEProtectionRemoverFactory(
-                               passphrasePrompt.getPassphrase(publicKey.getFingerprint(),
-                                               userKeyboxPath));
-
-               try (Stream<Path> keyFiles = Files.walk(USER_SECRET_KEY_DIR)) {
-                       for (Path keyFile : keyFiles.filter(Files::isRegularFile)
-                                       .collect(Collectors.toList())) {
-                               PGPSecretKey secretKey = attemptParseSecretKey(keyFile,
-                                               calculatorProvider, passphraseProvider, publicKey);
-                               if (secretKey != null) {
-                                       if (!secretKey.isSigningKey()) {
-                                               throw new PGPException(MessageFormat.format(
-                                                               JGitText.get().gpgNotASigningKey, signingKey));
-                                       }
-                                       return new BouncyCastleGpgKey(secretKey, userKeyboxPath);
-                               }
-                       }
-
-                       passphrasePrompt.clear();
-                       return null;
-               } catch (RuntimeException e) {
-                       passphrasePrompt.clear();
-                       throw e;
-               } catch (IOException e) {
-                       passphrasePrompt.clear();
-                       throw new PGPException(MessageFormat.format(
-                                       JGitText.get().gpgFailedToParseSecretKey,
-                                       USER_SECRET_KEY_DIR.toAbsolutePath()), e);
-               }
-       }
-
-       /**
-        * Return the first suitable key for signing in the key ring collection. For
-        * this case we only expect there to be one key available for signing.
-        * </p>
-        *
-        * @param signingkey
-        * @param secringFile
-        *
-        * @return the first suitable PGP secret key found for signing
-        * @throws IOException
-        *             on I/O related errors
-        * @throws PGPException
-        *             on BouncyCastle errors
-        */
-       private PGPSecretKey findSecretKeyInLegacySecring(String signingkey,
-                       Path secringFile) throws IOException, PGPException {
-
-               try (InputStream in = newInputStream(secringFile)) {
-                       PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(
-                                       PGPUtil.getDecoderStream(new BufferedInputStream(in)),
-                                       new JcaKeyFingerprintCalculator());
-
-                       String keyId = toFingerprint(signingkey).toLowerCase(Locale.ROOT);
-                       Iterator<PGPSecretKeyRing> keyrings = pgpSec.getKeyRings();
-                       while (keyrings.hasNext()) {
-                               PGPSecretKeyRing keyRing = keyrings.next();
-                               Iterator<PGPSecretKey> keys = keyRing.getSecretKeys();
-                               while (keys.hasNext()) {
-                                       PGPSecretKey key = keys.next();
-                                       // try key id
-                                       String fingerprint = Hex
-                                                       .toHexString(key.getPublicKey().getFingerprint())
-                                                       .toLowerCase(Locale.ROOT);
-                                       if (fingerprint.endsWith(keyId)) {
-                                               return key;
-                                       }
-                                       // try user id
-                                       Iterator<String> userIDs = key.getUserIDs();
-                                       while (userIDs.hasNext()) {
-                                               String userId = userIDs.next();
-                                               if (containsSigningKey(userId, signingKey)) {
-                                                       return key;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               return null;
-       }
-
-       /**
-        * Return the first public key matching the key id ({@link #signingKey}.
-        *
-        * @param pubringFile
-        *
-        * @return the PGP public key, or {@code null} if none found
-        * @throws IOException
-        *             on I/O related errors
-        * @throws PGPException
-        *             on BouncyCastle errors
-        */
-       private PGPPublicKey findPublicKeyInPubring(Path pubringFile)
-                       throws IOException, PGPException {
-               try (InputStream in = newInputStream(pubringFile)) {
-                       PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(
-                                       new BufferedInputStream(in),
-                                       new JcaKeyFingerprintCalculator());
-
-                       String keyId = toFingerprint(signingKey).toLowerCase(Locale.ROOT);
-                       Iterator<PGPPublicKeyRing> keyrings = pgpPub.getKeyRings();
-                       while (keyrings.hasNext()) {
-                               PGPPublicKeyRing keyRing = keyrings.next();
-                               Iterator<PGPPublicKey> keys = keyRing.getPublicKeys();
-                               while (keys.hasNext()) {
-                                       PGPPublicKey key = keys.next();
-                                       // try key id
-                                       String fingerprint = Hex.toHexString(key.getFingerprint())
-                                                       .toLowerCase(Locale.ROOT);
-                                       if (fingerprint.endsWith(keyId)) {
-                                               return key;
-                                       }
-                                       // try user id
-                                       Iterator<String> userIDs = key.getUserIDs();
-                                       while (userIDs.hasNext()) {
-                                               String userId = userIDs.next();
-                                               if (containsSigningKey(userId, signingKey)) {
-                                                       return key;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               return null;
-       }
-
-       private PGPPublicKey getPublicKey(KeyBlob blob, byte[] fingerprint)
-                       throws IOException {
-               return ((PublicKeyRingBlob) blob).getPGPPublicKeyRing()
-                               .getPublicKey(fingerprint);
-       }
-
-       private PGPPublicKey getSigningPublicKey(KeyBlob blob) throws IOException {
-               PGPPublicKey masterKey = null;
-               Iterator<PGPPublicKey> keys = ((PublicKeyRingBlob) blob)
-                               .getPGPPublicKeyRing().getPublicKeys();
-               while (keys.hasNext()) {
-                       PGPPublicKey key = keys.next();
-                       // only consider keys that have the [S] usage flag set
-                       if (isSigningKey(key)) {
-                               if (key.isMasterKey()) {
-                                       masterKey = key;
-                               } else {
-                                       return key;
-                               }
-                       }
-               }
-               // return the master key if no other signing key was found or null if
-               // the master key did not have the signing flag set
-               return masterKey;
-       }
-
-       private boolean isSigningKey(PGPPublicKey key) {
-               Iterator signatures = key.getSignatures();
-               while (signatures.hasNext()) {
-                       PGPSignature sig = (PGPSignature) signatures.next();
-                       if ((sig.getHashedSubPackets().getKeyFlags()
-                                       & PGPKeyFlags.CAN_SIGN) > 0) {
-                               return true;
-                       }
-               }
-               return false;
-       }
-
-       private KeyBox readKeyBoxFile(Path keyboxFile) throws IOException,
-                       NoSuchAlgorithmException, NoSuchProviderException,
-                       NoOpenPgpKeyException {
-               if (keyboxFile.toFile().length() == 0) {
-                       throw new NoOpenPgpKeyException();
-               }
-               KeyBox keyBox;
-               try (InputStream in = new BufferedInputStream(
-                               newInputStream(keyboxFile))) {
-                       keyBox = new JcaKeyBoxBuilder().build(in);
-               }
-               return keyBox;
-       }
-}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyPassphrasePrompt.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyPassphrasePrompt.java
deleted file mode 100644 (file)
index 6e29af5..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * Copyright (C) 2019, Salesforce. and others
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Distribution License v. 1.0 which is available at
- * https://www.eclipse.org/org/documents/edl-v10.php.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-package org.eclipse.jgit.lib.internal;
-
-import java.net.URISyntaxException;
-import java.nio.file.Path;
-import java.text.MessageFormat;
-
-import org.bouncycastle.openpgp.PGPException;
-import org.bouncycastle.util.encoders.Hex;
-import org.eclipse.jgit.api.errors.CanceledException;
-import org.eclipse.jgit.errors.UnsupportedCredentialItem;
-import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.transport.CredentialItem.CharArrayType;
-import org.eclipse.jgit.transport.CredentialItem.InformationalMessage;
-import org.eclipse.jgit.transport.CredentialsProvider;
-import org.eclipse.jgit.transport.URIish;
-
-/**
- * Prompts for a passphrase and caches it until {@link #clear() cleared}.
- * <p>
- * Implements {@link AutoCloseable} so it can be used within a
- * try-with-resources block.
- * </p>
- */
-class BouncyCastleGpgKeyPassphrasePrompt implements AutoCloseable {
-
-       private CharArrayType passphrase;
-
-       private CredentialsProvider credentialsProvider;
-
-       public BouncyCastleGpgKeyPassphrasePrompt(
-                       CredentialsProvider credentialsProvider) {
-               this.credentialsProvider = credentialsProvider;
-       }
-
-       /**
-        * Clears any cached passphrase
-        */
-       public void clear() {
-               if (passphrase != null) {
-                       passphrase.clear();
-                       passphrase = null;
-               }
-       }
-
-       @Override
-       public void close() {
-               clear();
-       }
-
-       private URIish createURI(Path keyLocation) throws URISyntaxException {
-               return new URIish(keyLocation.toUri().toString());
-       }
-
-       /**
-        * Prompts use for a passphrase unless one was cached from a previous
-        * prompt.
-        *
-        * @param keyFingerprint
-        *            the fingerprint to show to the user during prompting
-        * @param keyLocation
-        *            the location the key was loaded from
-        * @return the passphrase (maybe <code>null</code>)
-        * @throws PGPException
-        * @throws CanceledException
-        *             in case passphrase was not entered by user
-        * @throws URISyntaxException
-        * @throws UnsupportedCredentialItem
-        */
-       public char[] getPassphrase(byte[] keyFingerprint, Path keyLocation)
-                       throws PGPException, CanceledException, UnsupportedCredentialItem,
-                       URISyntaxException {
-               if (passphrase == null) {
-                       passphrase = new CharArrayType(JGitText.get().credentialPassphrase,
-                                       true);
-               }
-
-               if (credentialsProvider == null) {
-                       throw new PGPException(JGitText.get().gpgNoCredentialsProvider);
-               }
-
-               if (passphrase.getValue() == null
-                               && !credentialsProvider.get(createURI(keyLocation),
-                                               new InformationalMessage(
-                                                               MessageFormat.format(JGitText.get().gpgKeyInfo,
-                                                                               Hex.toHexString(keyFingerprint))),
-                                               passphrase)) {
-                       throw new CanceledException(JGitText.get().gpgSigningCancelled);
-               }
-               return passphrase.getValue();
-       }
-
-}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.java
deleted file mode 100644 (file)
index dfcfdab..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2018, Salesforce. and others
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Distribution License v. 1.0 which is available at
- * https://www.eclipse.org/org/documents/edl-v10.php.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-package org.eclipse.jgit.lib.internal;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Security;
-
-import org.bouncycastle.bcpg.ArmoredOutputStream;
-import org.bouncycastle.bcpg.BCPGOutputStream;
-import org.bouncycastle.bcpg.HashAlgorithmTags;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.openpgp.PGPException;
-import org.bouncycastle.openpgp.PGPPrivateKey;
-import org.bouncycastle.openpgp.PGPSecretKey;
-import org.bouncycastle.openpgp.PGPSignature;
-import org.bouncycastle.openpgp.PGPSignatureGenerator;
-import org.bouncycastle.openpgp.PGPSignatureSubpacketGenerator;
-import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
-import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
-import org.eclipse.jgit.annotations.NonNull;
-import org.eclipse.jgit.annotations.Nullable;
-import org.eclipse.jgit.api.errors.CanceledException;
-import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.errors.UnsupportedCredentialItem;
-import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.lib.CommitBuilder;
-import org.eclipse.jgit.lib.GpgSignature;
-import org.eclipse.jgit.lib.GpgSigner;
-import org.eclipse.jgit.lib.PersonIdent;
-import org.eclipse.jgit.transport.CredentialsProvider;
-
-/**
- * GPG Signer using BouncyCastle library
- */
-public class BouncyCastleGpgSigner extends GpgSigner {
-
-       private static void registerBouncyCastleProviderIfNecessary() {
-               if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
-                       Security.addProvider(new BouncyCastleProvider());
-               }
-       }
-
-       /**
-        * Create a new instance.
-        * <p>
-        * The BounceCastleProvider will be registered if necessary.
-        * </p>
-        */
-       public BouncyCastleGpgSigner() {
-               registerBouncyCastleProviderIfNecessary();
-       }
-
-       @Override
-       public boolean canLocateSigningKey(@Nullable String gpgSigningKey,
-                       PersonIdent committer, CredentialsProvider credentialsProvider)
-                       throws CanceledException {
-               try (BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt = new BouncyCastleGpgKeyPassphrasePrompt(
-                               credentialsProvider)) {
-                       BouncyCastleGpgKey gpgKey = locateSigningKey(gpgSigningKey,
-                                       committer, passphrasePrompt);
-                       return gpgKey != null;
-               } catch (PGPException | IOException | NoSuchAlgorithmException
-                               | NoSuchProviderException | URISyntaxException e) {
-                       return false;
-               }
-       }
-
-       private BouncyCastleGpgKey locateSigningKey(@Nullable String gpgSigningKey,
-                       PersonIdent committer,
-                       BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt)
-                       throws CanceledException, UnsupportedCredentialItem, IOException,
-                       NoSuchAlgorithmException, NoSuchProviderException, PGPException,
-                       URISyntaxException {
-               if (gpgSigningKey == null || gpgSigningKey.isEmpty()) {
-                       gpgSigningKey = '<' + committer.getEmailAddress() + '>';
-               }
-
-               BouncyCastleGpgKeyLocator keyHelper = new BouncyCastleGpgKeyLocator(
-                               gpgSigningKey, passphrasePrompt);
-
-               return keyHelper.findSecretKey();
-       }
-
-       @Override
-       public void sign(@NonNull CommitBuilder commit,
-                       @Nullable String gpgSigningKey, @NonNull PersonIdent committer,
-                       CredentialsProvider credentialsProvider) throws CanceledException {
-               try (BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt = new BouncyCastleGpgKeyPassphrasePrompt(
-                               credentialsProvider)) {
-                       BouncyCastleGpgKey gpgKey = locateSigningKey(gpgSigningKey,
-                                       committer, passphrasePrompt);
-                       PGPSecretKey secretKey = gpgKey.getSecretKey();
-                       if (secretKey == null) {
-                               throw new JGitInternalException(
-                                               JGitText.get().unableToSignCommitNoSecretKey);
-                       }
-                       char[] passphrase = passphrasePrompt.getPassphrase(
-                                       secretKey.getPublicKey().getFingerprint(),
-                                       gpgKey.getOrigin());
-                       PGPPrivateKey privateKey = secretKey
-                                       .extractPrivateKey(new JcePBESecretKeyDecryptorBuilder()
-                                                       .setProvider(BouncyCastleProvider.PROVIDER_NAME)
-                                                       .build(passphrase));
-                       PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(
-                                       new JcaPGPContentSignerBuilder(
-                                                       secretKey.getPublicKey().getAlgorithm(),
-                                                       HashAlgorithmTags.SHA256).setProvider(
-                                                                       BouncyCastleProvider.PROVIDER_NAME));
-                       signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey);
-                       PGPSignatureSubpacketGenerator subpacketGenerator = new PGPSignatureSubpacketGenerator();
-                       subpacketGenerator.setIssuerFingerprint(false,
-                                       secretKey.getPublicKey());
-                       signatureGenerator
-                                       .setHashedSubpackets(subpacketGenerator.generate());
-                       ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-                       try (BCPGOutputStream out = new BCPGOutputStream(
-                                       new ArmoredOutputStream(buffer))) {
-                               signatureGenerator.update(commit.build());
-                               signatureGenerator.generate().encode(out);
-                       }
-                       commit.setGpgSignature(new GpgSignature(buffer.toByteArray()));
-               } catch (PGPException | IOException | NoSuchAlgorithmException
-                               | NoSuchProviderException | URISyntaxException e) {
-                       throw new JGitInternalException(e.getMessage(), e);
-               }
-       }
-}
diff --git a/pom.xml b/pom.xml
index ec5cbc5aa81de6583b028bfcbfa112869371d4a7..eddb040a545b4552e7e6b442d63b8cd738797556 100644 (file)
--- a/pom.xml
+++ b/pom.xml
       <dependency>
         <groupId>org.bouncycastle</groupId>
         <artifactId>bcprov-jdk15on</artifactId>
-        <version>${bouncycastle-version}</version>
+        <version>1.65.01</version>
       </dependency>
 
       <dependency>
     <module>org.eclipse.jgit.ant</module>
     <module>org.eclipse.jgit.archive</module>
     <module>org.eclipse.jgit.ui</module>
+    <module>org.eclipse.jgit.gpg.bc</module>
     <module>org.eclipse.jgit.http.apache</module>
     <module>org.eclipse.jgit.http.server</module>
     <module>org.eclipse.jgit.ssh.apache</module>
 
     <module>org.eclipse.jgit.test</module>
     <module>org.eclipse.jgit.ant.test</module>
+    <module>org.eclipse.jgit.gpg.bc.test</module>
     <module>org.eclipse.jgit.http.test</module>
     <module>org.eclipse.jgit.pgm.test</module>
     <module>org.eclipse.jgit.lfs.test</module>