From 066021af9dcde9f3e760131921f2004c79ef6f47 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Wed, 18 Jul 2018 16:30:42 +0200 Subject: [PATCH] Use internal HashAlgorithm class for algorithm ids --- .../pgpainless/pgpainless/key/generation/KeyRingBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/pgpainless/pgpainless/key/generation/KeyRingBuilder.java b/src/main/java/org/pgpainless/pgpainless/key/generation/KeyRingBuilder.java index abd726b2..52a73207 100644 --- a/src/main/java/org/pgpainless/pgpainless/key/generation/KeyRingBuilder.java +++ b/src/main/java/org/pgpainless/pgpainless/key/generation/KeyRingBuilder.java @@ -44,6 +44,7 @@ import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder; import org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder; import org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyPair; import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder; +import org.pgpainless.pgpainless.algorithm.HashAlgorithm; import org.pgpainless.pgpainless.algorithm.KeyFlag; import org.pgpainless.pgpainless.key.collection.PGPKeyRing; import org.pgpainless.pgpainless.key.generation.type.ECDH; @@ -166,7 +167,7 @@ public class KeyRingBuilder implements KeyRingBuilderInterface { PGPDigestCalculator calculator = new JcaPGPDigestCalculatorProviderBuilder() .setProvider(BouncyCastleProvider.PROVIDER_NAME) .build() - .get(HashAlgorithmTags.SHA1); + .get(HashAlgorithm.SHA1.getAlgorithmId()); // Encryptor for encrypting secret keys PBESecretKeyEncryptor encryptor = passphrase == null ? @@ -189,7 +190,7 @@ public class KeyRingBuilder implements KeyRingBuilderInterface { // Signer for creating self-signature PGPContentSignerBuilder signer = new JcaPGPContentSignerBuilder( - certKey.getPublicKey().getAlgorithm(), HashAlgorithmTags.SHA512) + certKey.getPublicKey().getAlgorithm(), HashAlgorithm.SHA512.getAlgorithmId()) .setProvider(BouncyCastleProvider.PROVIDER_NAME); PGPSignatureSubpacketVector hashedSubPackets = certKeySpec.getSubpackets();