SlideShare a Scribd company logo
1 of 20
Java Security
                   Ferenc Tollas
       Sun Certified Developer for Java 2 Platform
            Sun Certified Programmer for JSE 5.0
“Java is secure”
Agenda
●   Java goals
●   Java Sandbox
●   Java Language Security
●   Bytecode verifier
●   Class loaders
●   Java Security Manager
●   Access Controller
●   JAAS
●   Java Cryptographic Extension (JCE)
Java goals
●   Originally developed by James Gosling
●   Goals:
    –   It should be "simple, object-oriented and familiar"
    –   It should be "robust and secure"
    –   It should be "architecture-neutral and portable"
    –   It should execute with "high performance"
    –   It should be "interpreted, threaded, and dynamic"
●   JDK 1.0 : January, 1996
Security requirements
Safe from malevolent programs
Programs should not be allowed to harm a user's computing environment, such as
Trojan horses and harmful programs that replicate, like computer viruses.
Non−intrusive
Programs should be prevented from discovering private information on the host
computer or the host computer's network
Authenticated, Encrypted, Audited, Well-defined security specification.....
●   Only the first two were within the province of Java's 1.0 default security model!
●   The other requirements were added in later versions of Java
How to provide the security related requirements:
●   Java Language security
●   Java sandbox implementation
●   Pluggable Security Extensions
Java Sandbox
●   provide an environment where the program can play
●   must be configurable by an end user or system administrator
●   Protect:
    – Memory
    – Files
    – Network
●   Minimal Sandbox: program has access to the CPU, the screen, keyboard, mouse and
    memory
●   Default Sandbox: CPU and its own memory as well as access to the web server from
    which it was loaded
●   Open sandbox : the program has access to whatever resources the host machine
    normally has access to
●   In early versions of Java, only applets were run within a sandbox.
●   In the Java 2 platform, all programs have the potential to run in a sandbox
Which is faster?
            Java's new or C's malloc?



Response:
www.ibm.com/developerworks/java/library/j-
jtp09275/index.html
Anatomy of a Java application
                                                    Bytecode Verifier:Java class files follow the
                                                     rules of the Java language

                                                        Class Loader: loads all Java classes and
                                                        can set permissions for each class it loads.
                                                    Security package:
                                                    ●    SPI
                                                    ●    Message digest
                                                    ●    Key and certificate handling
                                                    ●    Digital signatures
                                                    ●    Encryption : JCE, JSSE
                                                    ●    Authentication : JAAS

                                            Security Manager:the primary interface
                                            between the core API and the operating system
                                           Access Controller: allows or prevents most access
                                           from the core API to the operating system, uses the policy files..


Debug what happens in the background: −Djava.security.debug=all/access/failure
What is this:
           jre/lib/[arch]/client/clases.jsa
Elements of a sandbox
●   A sandbox is composed of five elements:
    –   Permissions : a specific action that code can perform
        ●   type, name and action: permission java.io.FilePermission "/tmp/foo", "read";
        ●   every Java class carries a set of permissions that defines the activities that the
            class is allowed to perform
        ●   core Java API are always given permission to perform any action
        ●   application can define its own permissions
    –   Code sources:location from which a class has been loaded.
        Combination of codebases and signers(alias listed in keystore).
    –   Protection domains: basic concept of sandbox, it is an association
        of permissions with a particular code source
                                                          DEMO
Elements of a sandbox
–   Policy files : contains one or more entries that define
    a protection domain.
     ● Global policy file:$JREHOME/lib/security/java.policy


     ● User specific: $HOME/.java.policy

    ●   Result: union of permissions contained in the global and user policy files
    ●   IMPORTANT: deny setting new policy file: java.security :
                         policy.allowSystemProperty=true
–   Keystores: The certificates themselves are held in a
    location (usually a file) called the keystore.
                      java −Djava.security.manager −Djava.security.policy=<URL>
Java language security
●   Question: how Java operates on things that are in memory?
●   Objects, primitive types has access level: public, protected,
    default/package or private
●   Programs cannot access arbitrary memory locations, no pointer and
    casting between int and Object is illegal.
●   Entities that are declared as final must not be changed.
●   Variables may not be used before they are initialized->instance variables
    are initialized automatically
●   Array bounds must be checked on all array accesses.
●   Object serialization....Mark with java.io.Serializable, and use keyword
    “transient”
●   These rules must be enforced! Compiler enforcement. Is it enough???
Bytecode verifier
●   No interface, users/coders cannot interact with it
●   Checks:
    –   The class file has the correct format
    –   Final classes are not subclassed, and final methods are not overridden.
    –   Every class (except for java.lang.Object) has a single superclass.
    –   There is no illegal data conversion of primitive data types (e.g., int to Object)
    –   There are no operand stack overflows or underflows
●   Delayed bytecode verification
●   Runtime verification:array bounds checking, object casting
Class loaders
●   mechanism by which files are read into the JVM and
    converted into class definitions
●   Responsibility:
    –   The security manager is consulted to see if this
         program is allowed to access the class in question
    –   Loads the class
    –   The security manager is consulted to see if this program
        is allowed to create the class in question
    –   The appropriate protection domain is created for the class
Java Security Manager
●   determines whether many particular operations
    should be permitted or rejected
●   −Djava.security.manager option installs a security
    manager
●   Partnership between the Ja5va API and the
    application
●   The SecurityException class is a subclass of the
    RuntimeException
       public FileInputStream(String name) throws FileNotFoundException {
           SecurityManager security = System.getSecurityManager( );
           if (security != null) {
               security.checkRead(name);
           }
           try {
               open(name);         // open( ) is a private method of this class
           } catch (IOException e) {
               throw new FileNotFoundException(name);
       } }
Access Controller
●   Security Manager is based entirely on access controller
●   Uses the policy file; is built on permissions, protection
    domains, code sources and policies
●   the access controller can do everything the security
    manager can do; historic reasons
●   the access controller is only available in Java 1.2
●   Applications always interact with the SecurityManager
JAAS
●   Java Authentication and Authorization Service
●   enforce access controls based on who runs
    the code(policy files: where code came from)
●   Features:
    –   Single sign-on support
    –   Pure Java
    –   Pluggable Authentication Module framework fir
        authentication
JCE
●   Java Cryptographic Extension
●   Features:
    –   Support for a wide range of standard algorithms
        including RSA, DSA, AES, Triple DES, SHA,
        PKCS#5, RC2, and RC4.
    –   Comprehensive API with support for a wide range of
        cryptographic services including digital signatures,
        message digests, ciphers (symmetric, asymmetric,
        stream & block), message authentication codes, key
        generators and key factories
JSSE
●   Java Secure Socket Extension
●   APIs and implementations for :
    –   Transport Layer Security (TLS),
    –   Secure Sockets Layer (SSL),
    –   Kerberos (accessible through GSS-API) and
    –   full support for HTTPS over SSL/TLS.
Questions?

More Related Content

What's hot (6)

Introduction to iOS Penetration Testing
Introduction to iOS Penetration TestingIntroduction to iOS Penetration Testing
Introduction to iOS Penetration Testing
 
Security in Java
Security in JavaSecurity in Java
Security in Java
 
Malware analysis
Malware analysisMalware analysis
Malware analysis
 
Protecting confidential files using SE-Linux
Protecting confidential files using SE-LinuxProtecting confidential files using SE-Linux
Protecting confidential files using SE-Linux
 
NCC Group 44Con Workshop: How to assess and secure ios apps
NCC Group 44Con Workshop: How to assess and secure ios appsNCC Group 44Con Workshop: How to assess and secure ios apps
NCC Group 44Con Workshop: How to assess and secure ios apps
 
[CONFidence 2016] Andrey Plastunov - Simple bugs to pwn the devs
[CONFidence 2016] Andrey Plastunov - Simple bugs to pwn the devs [CONFidence 2016] Andrey Plastunov - Simple bugs to pwn the devs
[CONFidence 2016] Andrey Plastunov - Simple bugs to pwn the devs
 

Viewers also liked (6)

Java notes(OOP) jkuat IT esection
Java notes(OOP) jkuat IT esectionJava notes(OOP) jkuat IT esection
Java notes(OOP) jkuat IT esection
 
Java 102 intro to object-oriented programming in java
Java 102   intro to object-oriented programming in javaJava 102   intro to object-oriented programming in java
Java 102 intro to object-oriented programming in java
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
 
UML for OOAD
UML for OOADUML for OOAD
UML for OOAD
 
Structured Vs, Object Oriented Analysis and Design
Structured Vs, Object Oriented Analysis and DesignStructured Vs, Object Oriented Analysis and Design
Structured Vs, Object Oriented Analysis and Design
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 

Similar to Tollas Ferenc - Java security

Java Platform Security Architecture
Java Platform Security ArchitectureJava Platform Security Architecture
Java Platform Security Architecture
Ramesh Nagappan
 
Sandboxing (Distributed computing)
Sandboxing (Distributed computing)Sandboxing (Distributed computing)
Sandboxing (Distributed computing)
Sri Prasanna
 

Similar to Tollas Ferenc - Java security (20)

Java Platform Security Architecture
Java Platform Security ArchitectureJava Platform Security Architecture
Java Platform Security Architecture
 
Chapter three Java_security.ppt
Chapter three Java_security.pptChapter three Java_security.ppt
Chapter three Java_security.ppt
 
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
Security Architecture of the Java Platform (BG OUG, Plovdiv, 13.06.2015)
 
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
Security Architecture of the Java Platform (http://www.javaday.bg event - 14....
 
Security Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java PlatformSecurity Аrchitecture of Тhe Java Platform
Security Аrchitecture of Тhe Java Platform
 
Martin Toshev - Java Security Architecture - Codemotion Rome 2019
Martin Toshev - Java Security Architecture - Codemotion Rome 2019Martin Toshev - Java Security Architecture - Codemotion Rome 2019
Martin Toshev - Java Security Architecture - Codemotion Rome 2019
 
Javantura v4 - Security architecture of the Java platform - Martin Toshev
Javantura v4 - Security architecture of the Java platform - Martin ToshevJavantura v4 - Security architecture of the Java platform - Martin Toshev
Javantura v4 - Security architecture of the Java platform - Martin Toshev
 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology
 
1 Introduction To Java Technology
1 Introduction To Java Technology 1 Introduction To Java Technology
1 Introduction To Java Technology
 
FEATURES OF JAVA
FEATURES OF JAVAFEATURES OF JAVA
FEATURES OF JAVA
 
From java to android a security analysis
From java to android  a security analysisFrom java to android  a security analysis
From java to android a security analysis
 
Features of java 02
Features of java 02Features of java 02
Features of java 02
 
Java Security
Java SecurityJava Security
Java Security
 
Secure JEE Architecture and Programming 101
Secure JEE Architecture and Programming 101Secure JEE Architecture and Programming 101
Secure JEE Architecture and Programming 101
 
Sandboxing (Distributed computing)
Sandboxing (Distributed computing)Sandboxing (Distributed computing)
Sandboxing (Distributed computing)
 
Auscert 2022 - log4shell and history of Java deserialisation RCE
Auscert 2022 - log4shell and history of Java deserialisation RCEAuscert 2022 - log4shell and history of Java deserialisation RCE
Auscert 2022 - log4shell and history of Java deserialisation RCE
 
Advanced Java
Advanced JavaAdvanced Java
Advanced Java
 
Java programming and security
Java programming and securityJava programming and security
Java programming and security
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote World
 

More from veszpremimeetup

Domján Balázs - Hang alapú kommunikáció
Domján Balázs - Hang alapú kommunikációDomján Balázs - Hang alapú kommunikáció
Domján Balázs - Hang alapú kommunikáció
veszpremimeetup
 
Tollas Ferenc - Process composer
Tollas Ferenc - Process composerTollas Ferenc - Process composer
Tollas Ferenc - Process composer
veszpremimeetup
 
Dömők Tamás, Kocsi Balázs - Élményeink a 24 órás programozási versenyen
Dömők Tamás, Kocsi Balázs - Élményeink a 24 órás programozási versenyenDömők Tamás, Kocsi Balázs - Élményeink a 24 órás programozási versenyen
Dömők Tamás, Kocsi Balázs - Élményeink a 24 órás programozási versenyen
veszpremimeetup
 
Bodócz Tamás- Web Perfomance & Caching Issues
Bodócz Tamás- Web Perfomance & Caching IssuesBodócz Tamás- Web Perfomance & Caching Issues
Bodócz Tamás- Web Perfomance & Caching Issues
veszpremimeetup
 

More from veszpremimeetup (11)

Blackmagic
BlackmagicBlackmagic
Blackmagic
 
Meetup startup
Meetup startupMeetup startup
Meetup startup
 
Égből pottyant paketek
Égből pottyant paketekÉgből pottyant paketek
Égből pottyant paketek
 
Domján Balázs - Hang alapú kommunikáció
Domján Balázs - Hang alapú kommunikációDomján Balázs - Hang alapú kommunikáció
Domján Balázs - Hang alapú kommunikáció
 
Tollas Ferenc - Process composer
Tollas Ferenc - Process composerTollas Ferenc - Process composer
Tollas Ferenc - Process composer
 
Dömők Tamás, Kocsi Balázs - Élményeink a 24 órás programozási versenyen
Dömők Tamás, Kocsi Balázs - Élményeink a 24 órás programozási versenyenDömők Tamás, Kocsi Balázs - Élményeink a 24 órás programozási versenyen
Dömők Tamás, Kocsi Balázs - Élményeink a 24 órás programozási versenyen
 
Bodócz Tamás- Web Perfomance & Caching Issues
Bodócz Tamás- Web Perfomance & Caching IssuesBodócz Tamás- Web Perfomance & Caching Issues
Bodócz Tamás- Web Perfomance & Caching Issues
 
Bodócz Tamás - Website Perfomance & Load Test - Warm-up
Bodócz Tamás - Website Perfomance & Load Test - Warm-upBodócz Tamás - Website Perfomance & Load Test - Warm-up
Bodócz Tamás - Website Perfomance & Load Test - Warm-up
 
Stange Szilárd - Bird's eye view
Stange Szilárd - Bird's eye viewStange Szilárd - Bird's eye view
Stange Szilárd - Bird's eye view
 
Magyar Attila - Kata és a TDD a dojoban
Magyar Attila - Kata és a TDD a dojobanMagyar Attila - Kata és a TDD a dojoban
Magyar Attila - Kata és a TDD a dojoban
 
Györkő Zoltán - Startup how to
Györkő Zoltán - Startup how toGyörkő Zoltán - Startup how to
Györkő Zoltán - Startup how to
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Tollas Ferenc - Java security

  • 1. Java Security Ferenc Tollas Sun Certified Developer for Java 2 Platform Sun Certified Programmer for JSE 5.0
  • 3. Agenda ● Java goals ● Java Sandbox ● Java Language Security ● Bytecode verifier ● Class loaders ● Java Security Manager ● Access Controller ● JAAS ● Java Cryptographic Extension (JCE)
  • 4. Java goals ● Originally developed by James Gosling ● Goals: – It should be "simple, object-oriented and familiar" – It should be "robust and secure" – It should be "architecture-neutral and portable" – It should execute with "high performance" – It should be "interpreted, threaded, and dynamic" ● JDK 1.0 : January, 1996
  • 5. Security requirements Safe from malevolent programs Programs should not be allowed to harm a user's computing environment, such as Trojan horses and harmful programs that replicate, like computer viruses. Non−intrusive Programs should be prevented from discovering private information on the host computer or the host computer's network Authenticated, Encrypted, Audited, Well-defined security specification..... ● Only the first two were within the province of Java's 1.0 default security model! ● The other requirements were added in later versions of Java How to provide the security related requirements: ● Java Language security ● Java sandbox implementation ● Pluggable Security Extensions
  • 6. Java Sandbox ● provide an environment where the program can play ● must be configurable by an end user or system administrator ● Protect: – Memory – Files – Network ● Minimal Sandbox: program has access to the CPU, the screen, keyboard, mouse and memory ● Default Sandbox: CPU and its own memory as well as access to the web server from which it was loaded ● Open sandbox : the program has access to whatever resources the host machine normally has access to ● In early versions of Java, only applets were run within a sandbox. ● In the Java 2 platform, all programs have the potential to run in a sandbox
  • 7. Which is faster? Java's new or C's malloc? Response: www.ibm.com/developerworks/java/library/j- jtp09275/index.html
  • 8. Anatomy of a Java application Bytecode Verifier:Java class files follow the rules of the Java language Class Loader: loads all Java classes and can set permissions for each class it loads. Security package: ● SPI ● Message digest ● Key and certificate handling ● Digital signatures ● Encryption : JCE, JSSE ● Authentication : JAAS Security Manager:the primary interface between the core API and the operating system Access Controller: allows or prevents most access from the core API to the operating system, uses the policy files.. Debug what happens in the background: −Djava.security.debug=all/access/failure
  • 9. What is this: jre/lib/[arch]/client/clases.jsa
  • 10. Elements of a sandbox ● A sandbox is composed of five elements: – Permissions : a specific action that code can perform ● type, name and action: permission java.io.FilePermission "/tmp/foo", "read"; ● every Java class carries a set of permissions that defines the activities that the class is allowed to perform ● core Java API are always given permission to perform any action ● application can define its own permissions – Code sources:location from which a class has been loaded. Combination of codebases and signers(alias listed in keystore). – Protection domains: basic concept of sandbox, it is an association of permissions with a particular code source DEMO
  • 11. Elements of a sandbox – Policy files : contains one or more entries that define a protection domain. ● Global policy file:$JREHOME/lib/security/java.policy ● User specific: $HOME/.java.policy ● Result: union of permissions contained in the global and user policy files ● IMPORTANT: deny setting new policy file: java.security : policy.allowSystemProperty=true – Keystores: The certificates themselves are held in a location (usually a file) called the keystore. java −Djava.security.manager −Djava.security.policy=<URL>
  • 12. Java language security ● Question: how Java operates on things that are in memory? ● Objects, primitive types has access level: public, protected, default/package or private ● Programs cannot access arbitrary memory locations, no pointer and casting between int and Object is illegal. ● Entities that are declared as final must not be changed. ● Variables may not be used before they are initialized->instance variables are initialized automatically ● Array bounds must be checked on all array accesses. ● Object serialization....Mark with java.io.Serializable, and use keyword “transient” ● These rules must be enforced! Compiler enforcement. Is it enough???
  • 13. Bytecode verifier ● No interface, users/coders cannot interact with it ● Checks: – The class file has the correct format – Final classes are not subclassed, and final methods are not overridden. – Every class (except for java.lang.Object) has a single superclass. – There is no illegal data conversion of primitive data types (e.g., int to Object) – There are no operand stack overflows or underflows ● Delayed bytecode verification ● Runtime verification:array bounds checking, object casting
  • 14. Class loaders ● mechanism by which files are read into the JVM and converted into class definitions ● Responsibility: – The security manager is consulted to see if this program is allowed to access the class in question – Loads the class – The security manager is consulted to see if this program is allowed to create the class in question – The appropriate protection domain is created for the class
  • 15. Java Security Manager ● determines whether many particular operations should be permitted or rejected ● −Djava.security.manager option installs a security manager ● Partnership between the Ja5va API and the application ● The SecurityException class is a subclass of the RuntimeException public FileInputStream(String name) throws FileNotFoundException { SecurityManager security = System.getSecurityManager( ); if (security != null) { security.checkRead(name); } try { open(name); // open( ) is a private method of this class } catch (IOException e) { throw new FileNotFoundException(name); } }
  • 16. Access Controller ● Security Manager is based entirely on access controller ● Uses the policy file; is built on permissions, protection domains, code sources and policies ● the access controller can do everything the security manager can do; historic reasons ● the access controller is only available in Java 1.2 ● Applications always interact with the SecurityManager
  • 17. JAAS ● Java Authentication and Authorization Service ● enforce access controls based on who runs the code(policy files: where code came from) ● Features: – Single sign-on support – Pure Java – Pluggable Authentication Module framework fir authentication
  • 18. JCE ● Java Cryptographic Extension ● Features: – Support for a wide range of standard algorithms including RSA, DSA, AES, Triple DES, SHA, PKCS#5, RC2, and RC4. – Comprehensive API with support for a wide range of cryptographic services including digital signatures, message digests, ciphers (symmetric, asymmetric, stream & block), message authentication codes, key generators and key factories
  • 19. JSSE ● Java Secure Socket Extension ● APIs and implementations for : – Transport Layer Security (TLS), – Secure Sockets Layer (SSL), – Kerberos (accessible through GSS-API) and – full support for HTTPS over SSL/TLS.