|
|
@ -52,6 +52,7 @@ import java.security.GeneralSecurityException; |
|
|
|
import java.security.spec.AlgorithmParameterSpec; |
|
|
|
import java.security.spec.AlgorithmParameterSpec; |
|
|
|
import java.security.spec.KeySpec; |
|
|
|
import java.security.spec.KeySpec; |
|
|
|
import java.text.MessageFormat; |
|
|
|
import java.text.MessageFormat; |
|
|
|
|
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Properties; |
|
|
|
import java.util.Properties; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.regex.Pattern; |
|
|
@ -192,7 +193,7 @@ abstract class WalkEncryption { |
|
|
|
|
|
|
|
|
|
|
|
// Standard names are not case-sensitive.
|
|
|
|
// Standard names are not case-sensitive.
|
|
|
|
// http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html
|
|
|
|
// http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html
|
|
|
|
String cryptoName = cryptoAlg.toUpperCase(); |
|
|
|
String cryptoName = cryptoAlg.toUpperCase(Locale.ROOT); |
|
|
|
|
|
|
|
|
|
|
|
if (!cryptoName.startsWith("PBE")) //$NON-NLS-1$
|
|
|
|
if (!cryptoName.startsWith("PBE")) //$NON-NLS-1$
|
|
|
|
throw new GeneralSecurityException(JGitText.get().encryptionOnlyPBE); |
|
|
|
throw new GeneralSecurityException(JGitText.get().encryptionOnlyPBE); |
|
|
@ -373,7 +374,7 @@ abstract class WalkEncryption { |
|
|
|
|
|
|
|
|
|
|
|
SecretKey keyBase = factory.generateSecret(keySpec); |
|
|
|
SecretKey keyBase = factory.generateSecret(keySpec); |
|
|
|
|
|
|
|
|
|
|
|
String name = cipherAlgo.toUpperCase(); |
|
|
|
String name = cipherAlgo.toUpperCase(Locale.ROOT); |
|
|
|
Matcher matcherPBE = Pattern.compile(REGEX_PBE).matcher(name); |
|
|
|
Matcher matcherPBE = Pattern.compile(REGEX_PBE).matcher(name); |
|
|
|
Matcher matcherTrans = Pattern.compile(REGEX_TRANS).matcher(name); |
|
|
|
Matcher matcherTrans = Pattern.compile(REGEX_TRANS).matcher(name); |
|
|
|
if (matcherPBE.matches()) { |
|
|
|
if (matcherPBE.matches()) { |
|
|
@ -506,7 +507,7 @@ abstract class WalkEncryption { |
|
|
|
JGitV1(String algo, String pass) |
|
|
|
JGitV1(String algo, String pass) |
|
|
|
throws GeneralSecurityException { |
|
|
|
throws GeneralSecurityException { |
|
|
|
super(wrap(algo, pass)); |
|
|
|
super(wrap(algo, pass)); |
|
|
|
String name = cipherAlgo.toUpperCase(); |
|
|
|
String name = cipherAlgo.toUpperCase(Locale.ROOT); |
|
|
|
Matcher matcherPBE = Pattern.compile(REGEX_PBE).matcher(name); |
|
|
|
Matcher matcherPBE = Pattern.compile(REGEX_PBE).matcher(name); |
|
|
|
if (!matcherPBE.matches()) |
|
|
|
if (!matcherPBE.matches()) |
|
|
|
throw new GeneralSecurityException( |
|
|
|
throw new GeneralSecurityException( |
|
|
|