8000 High-Level API #0: Preparations for high-level OpenPGP Key Generator API by vanitasvitae · Pull Request #1926 · bcgit/bc-java · GitHub
[go: up one dir, main page]

Skip to content

High-Level API #0: Preparations for high-level OpenPGP Key Generator API #1926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add PublicKeyUtils
This class contains methods for checking properties of public key algorithms
  • Loading branch information
vanitasvitae committed Dec 17, 2024
commit 03261c041b34b123706b574eda027afbba99d5cc
45 changes: 22 additions & 23 deletions pg/src/main/java/org/bouncycastle/bcpg/PublicKeyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,26 @@ public static boolean isSigningAlgorithm(int publicKeyAlgorithm)
}
}

// /**
// * Return true, if the public key algorithm that corresponds to the given ID is capable of encryption.
// *
// * @param publicKeyAlgorithm public key algorithm id
// * @return true if algorithm can encrypt
// */
// public static boolean isEncryptionAlgorithm(int publicKeyAlgorithm)
// {
// switch (publicKeyAlgorithm)
// {
// case PublicKeyAlgorithmTags.RSA_GENERAL:
// case PublicKeyAlgorithmTags.RSA_ENCRYPT:
// case PublicKeyAlgorithmTags.ELGAMAL_ENCRYPT:
// case PublicKeyAlgorithmTags.ECDH:
// case PublicKeyAlgorithmTags.ELGAMAL_GENERAL:
// case PublicKeyAlgorithmTags.DIFFIE_HELLMAN:
// case PublicKeyAlgorithmTags.X25519:
// case PublicKeyAlgorithmTags.X448:
// return true;
// default:
// return false;
// }
// }
/**
* Return true, if the public key algorithm that corresponds to the given ID is capable of encryption.
* @param publicKeyAlgorithm public key algorithm id
* @return true if algorithm can encrypt
*/
public static boolean isEncryptionAlgorithm(int publicKeyAlgorithm)
{
switch (publicKeyAlgorithm)
{
case PublicKeyAlgorithmTags.RSA_GENERAL:
case PublicKeyAlgorithmTags.RSA_ENCRYPT:
case PublicKeyAlgorithmTags.ELGAMAL_ENCRYPT:
case PublicKeyAlgorithmTags.ECDH:
case PublicKeyAlgorithmTags.ELGAMAL_GENERAL:
case PublicKeyAlgorithmTags.DIFFIE_HELLMAN:
case PublicKeyAlgorithmTags.X25519:
case PublicKeyAlgorithmTags.X448:
return true;
default:
return false;
}
}
}
0