- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Signature getAlgorithm() method with Examples
The name of the algorithm for the signature object can be obtained using the method getAlgorithm() in the class java.security.Signature.
Let us now see an example −
Example
import java.security.*; import java.util.*; public class Main { public static void main(String[] argv) { try { Signature signature = Signature.getInstance("SHA256withRSA"); String algorithm = signature.getAlgorithm(); System.out.println("The Algorithm = " + algorithm); } catch (NoSuchAlgorithmException e) { System.out.println("Error!! NoSuchAlgorithmException"); } } }
Output
The Algorithm = SHA256withRSA
Let us now see another example −
Example
import java.security.*; import java.util.*; public class Main { public static void main(String[] argv) { try { Signature signature = Signature.getInstance("SHA1withDSA"); String algorithm = signature.getAlgorithm(); System.out.println("The Algorithm = " + algorithm); } catch (NoSuchAlgorithmException e) { System.out.println("Error!! NoSuchAlgorithmException"); } } }
Output
The Algorithm = SHA1withDSA
- Related Articles
- Java Signature getAlgorithm() method
- Java Signature getInstance() method with Examples
- Java Signature getProvider() method with Examples
- Java Signature initSign() method with Examples
- Java Signature toString() method with Examples
- SecureRandom getAlgorithm() method in Java
- KeyPairGenerator getAlgorithm() method in Java
- KeyFactory getAlgorithm() method in Java
- AlgorithmParameterGenerator getAlgorithm() method in Java
- Java Signature getProvider() method
- Java Signature toString() method
- Java Signature getInstance() method
- Java toDegrees() method with Examples
- Java signum() method with Examples
- Java lang.Long.toBinaryString() method with Examples

Advertisements