mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-04 08:15:02 -05:00
make constant for certify hash algo
This commit is contained in:
parent
4ed1bf0ca4
commit
82a2a76a33
@ -18,9 +18,7 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.pgp;
|
package org.sufficientlysecure.keychain.pgp;
|
||||||
|
|
||||||
import org.spongycastle.bcpg.HashAlgorithmTags;
|
|
||||||
import org.spongycastle.bcpg.S2K;
|
import org.spongycastle.bcpg.S2K;
|
||||||
import org.spongycastle.bcpg.SymmetricKeyAlgorithmTags;
|
|
||||||
import org.spongycastle.openpgp.PGPException;
|
import org.spongycastle.openpgp.PGPException;
|
||||||
import org.spongycastle.openpgp.PGPPrivateKey;
|
import org.spongycastle.openpgp.PGPPrivateKey;
|
||||||
import org.spongycastle.openpgp.PGPPublicKey;
|
import org.spongycastle.openpgp.PGPPublicKey;
|
||||||
@ -31,7 +29,6 @@ import org.spongycastle.openpgp.PGPSignatureGenerator;
|
|||||||
import org.spongycastle.openpgp.PGPSignatureSubpacketGenerator;
|
import org.spongycastle.openpgp.PGPSignatureSubpacketGenerator;
|
||||||
import org.spongycastle.openpgp.PGPSignatureSubpacketVector;
|
import org.spongycastle.openpgp.PGPSignatureSubpacketVector;
|
||||||
import org.spongycastle.openpgp.PGPUserAttributeSubpacketVector;
|
import org.spongycastle.openpgp.PGPUserAttributeSubpacketVector;
|
||||||
import org.spongycastle.openpgp.PGPUtil;
|
|
||||||
import org.spongycastle.openpgp.operator.PBESecretKeyDecryptor;
|
import org.spongycastle.openpgp.operator.PBESecretKeyDecryptor;
|
||||||
import org.spongycastle.openpgp.operator.PGPContentSignerBuilder;
|
import org.spongycastle.openpgp.operator.PGPContentSignerBuilder;
|
||||||
import org.spongycastle.openpgp.operator.PublicKeyDataDecryptorFactory;
|
import org.spongycastle.openpgp.operator.PublicKeyDataDecryptorFactory;
|
||||||
@ -43,13 +40,11 @@ import org.spongycastle.openpgp.operator.jcajce.NfcSyncPublicKeyDataDecryptorFac
|
|||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -287,9 +282,8 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
|
|||||||
// create a signatureGenerator from the supplied masterKeyId and passphrase
|
// create a signatureGenerator from the supplied masterKeyId and passphrase
|
||||||
PGPSignatureGenerator signatureGenerator;
|
PGPSignatureGenerator signatureGenerator;
|
||||||
{
|
{
|
||||||
// TODO: SHA256 fixed?
|
PGPContentSignerBuilder contentSignerBuilder = getContentSignerBuilder(
|
||||||
PGPContentSignerBuilder contentSignerBuilder = getContentSignerBuilder(PGPUtil.SHA256,
|
PgpConstants.CERTIFY_HASH_ALGO, nfcSignedHash, nfcCreationTimestamp);
|
||||||
nfcSignedHash, nfcCreationTimestamp);
|
|
||||||
|
|
||||||
signatureGenerator = new PGPSignatureGenerator(contentSignerBuilder);
|
signatureGenerator = new PGPSignatureGenerator(contentSignerBuilder);
|
||||||
try {
|
try {
|
||||||
@ -351,9 +345,8 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {
|
|||||||
// create a signatureGenerator from the supplied masterKeyId and passphrase
|
// create a signatureGenerator from the supplied masterKeyId and passphrase
|
||||||
PGPSignatureGenerator signatureGenerator;
|
PGPSignatureGenerator signatureGenerator;
|
||||||
{
|
{
|
||||||
// TODO: SHA256 fixed?
|
PGPContentSignerBuilder contentSignerBuilder = getContentSignerBuilder(
|
||||||
PGPContentSignerBuilder contentSignerBuilder = getContentSignerBuilder(PGPUtil.SHA256,
|
PgpConstants.CERTIFY_HASH_ALGO, nfcSignedHash, nfcCreationTimestamp);
|
||||||
nfcSignedHash, nfcCreationTimestamp);
|
|
||||||
|
|
||||||
signatureGenerator = new PGPSignatureGenerator(contentSignerBuilder);
|
signatureGenerator = new PGPSignatureGenerator(contentSignerBuilder);
|
||||||
try {
|
try {
|
||||||
|
@ -58,6 +58,8 @@ public class PgpConstants {
|
|||||||
sPreferredCompressionAlgorithms.add(CompressionAlgorithmTags.ZIP);
|
sPreferredCompressionAlgorithms.add(CompressionAlgorithmTags.ZIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final int CERTIFY_HASH_ALGO = HashAlgorithmTags.SHA256;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: s2kcount is a number between 0 and 0xff that controls the
|
* Note: s2kcount is a number between 0 and 0xff that controls the
|
||||||
* number of times to iterate the password hash before use. More
|
* number of times to iterate the password hash before use. More
|
||||||
|
Loading…
Reference in New Issue
Block a user