0% found this document useful (0 votes)
43 views

Java Digital Assessment

The Java security package includes classes for security algorithms, mechanisms, and protocols. Some key classes are AlgorithmParameters, KeyFactory, KeyPair, KeyStore, MessageDigest, Permission, Provider, SecureRandom, and Signature. The code sample hides text in an image by adding a JTextArea containing the text to a JFrame when a button is clicked. The text is displayed over the image with a black background and green text color.

Uploaded by

chitti sharan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Java Digital Assessment

The Java security package includes classes for security algorithms, mechanisms, and protocols. Some key classes are AlgorithmParameters, KeyFactory, KeyPair, KeyStore, MessageDigest, Permission, Provider, SecureRandom, and Signature. The code sample hides text in an image by adding a JTextArea containing the text to a JFrame when a button is clicked. The text is displayed over the image with a black background and green text color.

Uploaded by

chitti sharan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

School of Information Technology and Engineering

FS-2022-23
M. Tech (Software Engineering)
JAVA DIGITAL ASSESSMENT

Course Code: SWE1007 Course title: Programming in Java


NAME: C. SHARAN KUMAR REDDY
REG. NO: 21MIS0098

 Explain Java’s security package and its classes in detail.


Write a Java program to hide a text into an image
Java security includes a large set of APIs, tools, and
implementations of commonly-used security algorithms, mechanisms, and
protocols. Package java.security Description Provides the classes and
interfaces for the security framework. All the classes which are related for
management of security related concerns in the java program are provided
under this package. Some Security classes are discussed below:
• AlgorithmParameters – The class is used for the representation of various
parameters which are opaque.
• AllPermission – The class instances reflect that all other permissions are
provided to the entity.
• KeyFactory - The class is used for the conversion of keys into its respective
specifications and vice versa.
• KeyFactorySpi – The class instances define SPI for the KeyFactory class.
• KeyPair – The class is basically is a holder for the key values.
• KeyPairGenerator – The class instances are used for the generation of
various keys with the required access specifiers.
• KeyPairGeneratorSpi – The class instances represent the SPI for the
KeyPairGenerator class.
• KeyRep – The class instances represent the various key values.
• KeyStore – The class is used as a store house for various types of keys.
• KeyStore.Builder – The class is used by the Keystore class.
• KeyStore.CallbackHandlerProtection – The class is a wrapper type for the
CallbackHandler.
• KeyStore.PasswordProtection – The class instances support authentication
related security.
• KeyStore.PrivateKeyEntry – The class instances represent the private key.
• KeyStore.TrustedCertificateEntry - The class instances represent the
certificate entry.
• MessageDigest – The class provides the programs wirh MessageDigest
facility.
• Permission – The class is meant to handle concerns related to accessing of
system resources.
• PermissionCollection – It is an abstract class. The class represents a
collection of permission objects.
• Policy – The instances of the class determine whether the code being
executed by the JVM has required permission to access the security policies.
• ProtectionDomain – All the characteristics of a domain are wrapped in the
class. • Provider – The class instance acts as a JDBC API provider.
• Provider.Service – The class instances provide various relevant information
regarding the security services.
• SecureRandom – A random number generator is provided by this class.
• Security – All the security related concerns and the specific properties are
provided by this class.
• SecurityPermission – All the security related permissions are provided by
this class.
• Signature – Signal related algorithms are provided by the class instances.
• SignatureSpi – The class instances create SPI for the Signature class.
• SignedObject – The class created various runtime objects. The authenticity
of the objects created is strict.
• Timestamp – related information is reflected by the class.
• UnresolvedPermission – The class instances hold various permission
concerns which were left unresolved.
• URIParameter – The class contains the parameter which points to an URL
address.

SOURCE CODE:
package Welcome;
import java.awt.*;
import java.awt.event.*;
import java.util.Objects;
import javax.swing.*;
public class HiddenText extends JFrame implements ActionListener {
JButton b ;
JLabel l;
ImageIcon i;
JFrame f = new JFrame();
JTextArea t ;

public HiddenText()
{
f.setTitle("Text hidden in image");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
try
{
i = new ImageIcon(Objects.requireNonNull(getClass().getResource("\\
appleLogo.jpg")));
l = new JLabel(i);
l.setBounds(0, 0, 1000, 800);
f.add(l);
}
catch(Exception e)
{
System.out.println("Image can not be found : \n" + e);
}
validate();
b = new JButton("CLICK HERE");
b.setBounds(480,600,80,40);
b.setBorder(null);

f.add(b);

f.setLayout(null);
f.setVisible(true);

b.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {


t = new JTextArea("Hello,Welcome to Java World......");
t.setBackground(Color.black);
t.setForeground(Color.green);
t.setVisible(true);
t.setBounds(10, 0, 200, 100);
f.add(t);
}
});

}
public static void main(String[] args) {
new HiddenText();
}
@Override
public void actionPerformed(ActionEvent e) {
repaint();
}
}
OUTPUT:

You might also like