0%

Book Description

This book is a comprehensive guide to Java security issues. It assumes you are an experienced Java programmer, but have little experience with creating secure applications. This book covers formulating and enacting a network security policy to protect end-users, building e-commerce and database applications that can safely exchange secure information over networks and the Internet, cryptography, digital signatures, key management, and distributed computing: CORBA, RMI, and servlets.

Table of Contents

  1. Copyright
    1. Dedication
  2. About the Authors
  3. Acknowledgments
  4. Tell Us What You Think!
  5. Introduction
    1. The Importance of Java Security
    2. Who Should Read This Book
    3. How This Book is Organized
    4. Getting Started
    5. How to Use This Book
  6. I. The Foundations of Java Security
    1. 1. Security Basics
      1. The Basic Security Model
      2. Cryptography
        1. Classes of Cryptography
        2. Message Digests
        3. Symmetric Keys
        4. Asymmetric Keys
      3. Authentication and Nonrepudiation
        1. Authentication Types
          1. Password-Based Identity and Authentication
          2. Physical-Token–Based Identity and Authentication
          3. Biometrics-Based Identity and Authentication
          4. Certificate-Based Identity and Authentication
        2. Nonrepudiation
      4. Access Control
        1. Discretionary Access Control
        2. Role-Based Access Control
        3. Mandatory Access Control
        4. Firewall Access Control
      5. Domains
      6. Auditing
      7. Policies and Administration
      8. Summary
    2. 2. Java Security Overview
      1. The History of Security in Java
      2. Java Security Architecture
        1. Core Java 2 Security Architecture
        2. Java Cryptography Architecture
        3. Java Cryptography Extension
        4. Java Secure Socket Extension
        5. Java Authentication and Authorization Service
      3. Byte Code Verifier
      4. Class Loader
        1. Class Loader Architecture and Security
        2. Class-Loader Interfaces
      5. Security Manager
        1. Security Manager Interfaces
        2. Custom Security Managers
      6. Java Cryptography Architecture
        1. The Architecture of JCA
        2. Cryptographic Engines
        3. Cryptographic Service Providers
      7. Summary
    3. 3. Java Application Security Access Control
      1. Permissions
        1. Permissions Architecture
        2. Permission Types
        3. Custom Permission Types
      2. Security Policies
        1. Security Policy File Format
        2. Referencing Properties in Policy Files
        3. Using Security Policy Files
        4. Security Policy Tool
        5. Security Policy APIs
      3. Java Access Control
        1. Access Control Architecture
        2. Guarded Objects
        3. SecurityManager-to-Access Control Mapping
        4. Fine-Grained and Configurable Access Control Example
      4. Summary
    4. 4. Applet Security
      1. Extending the Sandbox
        1. The JDK 1.0 Sandbox
        2. The JDK 1.1 Sandbox
        3. JDK 1.2 Least Privilege
      2. Specifying an Applet Security Policy
        1. The Contents of the Security Policy File
        2. The Syntax of Grant Entries
      3. Using Signed Applets
        1. Creating the JAR file
        2. Signing the JAR File
        3. Specifying a Signed Applet Policy
      4. Obtaining a Signing Certificate
      5. Working with Different Browsers
      6. Summary
  7. II. Cryptographic Security
    1. 5. Introduction to Cryptography
      1. A Short History of Secret Writing
      2. Cryptography, Cryptanalysis, and Cryptology
      3. Ciphers
        1. The Caesar Cipher
          1. Cryptanalysis of the Caesar Cipher
        2. A Simple Substitution Cipher
          1. Cryptanalysis of the Simple Substitution Cipher
      4. Secret-Key Cryptography
        1. The Data Encryption Standard (DES)
          1. DES Modes
            1. ECB Mode and Padding
            2. CBC Mode
            3. PCBC Mode
            4. CFB Mode
            5. OFB Mode
            6. Which Mode Should I Use?
          2. A DES Example
        2. DESede
        3. Blowfish
        4. Rivest Ciphers
      5. Public Key Cryptography
        1. The Rivest, Shamir, Adleman (RSA) Algorithm
          1. An RSA Example
          2. Using RSA
          3. RSA Performance and Security
        2. The ElGamal Algorithm
      6. Message Digests
        1. MD5
        2. SHA-1
        3. Base 64 Encoding
      7. Digital Signatures
        1. The Digital Signature Algorithm
      8. Digital Certificates
      9. Summary
    2. 6. Key Management and Digital Certificates
      1. Importance of Key Management
      2. Key Representation
      3. Key Generation
        1. The KeyPairGenerator Class
        2. The KeyGenerator Class
        3. The KeyGeneratorApp Program
        4. Secure Random Numbers and Key Generation
        5. Key Translation
          1. The KeyFactory Class
          2. The SecretKeyFactory Class
      4. Key Agreement
        1. Simple Key Management for Internet Protocols (SKIP)
        2. JCE Support for Key Agreement
          1. Examples of Implementing Key Agreements
      5. Key Storage and Password-Based Encryption
      6. Key Management Differences Between JDK 1.1 and the Java 2 Platform (version JDK 1.2)
        1. JDK 1.1 Key Management
          1. The Identity Class
          2. The IdentityScope Class
          3. The Signer Class
        2. JDK 1.2 Key Management
          1. The KeyStore Class
      7. The Keytool
      8. Summary
    3. 7. Message Digests and Digital Signatures
      1. Message Digest Classes and Interfaces
        1. MessageDigestSpi
        2. MessageDigest
          1. Computing Message Digests
        3. DigestInputStream and DigestOutputStream
        4. Working with Digest Streams
        5. DigestException
      2. Message Authentication Codes
        1. MacSpi
        2. Mac
        3. MACs in Action
      3. Signature Classes and Interfaces
        1. SignatureSpi
        2. Signature
          1. Creating and Verifying Digital Signatures
        3. SignedObject
          1. Using SignedObject
        4. Signer
        5. SignatureException
      4. Summary
    4. 8. The Java Cryptography Extension
      1. Inside the JCE
      2. The Cryptix JCE
      3. Security Providers and Algorithm Independence
      4. How a Security Provider Is Organized
        1. Engine Classes
        2. SPI Classes
        3. Provider Classes
      5. Creating a New Provider
        1. Extending the SPI Class
        2. Extending the Provider Class
        3. Installing Provider Classes
      6. Using the Provider
      7. Summary
    5. 9. SSL and JSSE
      1. SSL Overview
      2. Java Secure Socket Extension Overview
        1. JSSE Package and Class Overview
      3. JSSE Providers
      4. JSSE SSL Server Sockets
        1. Obtaining an SSL Server Socket Factory
        2. Creating SSL Server Sockets
        3. SSL Server Socket Listening
        4. Client Authentication
      5. JSSE SSL Client Sockets
        1. Obtaining an SSL Socket Factory
        2. Creating SSL Client Sockets
      6. JSSE SSL Sessions
      7. Summary
  8. III. Distributed System Security
    1. 10. Distributed Enterprise Security Overview
      1. Distributed Enterprise System Technology
        1. Enterprise Database Connectivity
        2. Enterprise Communications
        3. Enterprise Communication Services
        4. Enterprise Container-Based Components
      2. Enterprise Database Connectivity Security
      3. Enterprise Communications Security
        1. Basic Network Security
        2. RMI Security
        3. CORBA Security
      4. Enterprise Communications Service Security
        1. JNDI Security
        2. Jini Security
        3. JMS Security
        4. JavaMail Security
      5. Enterprise Container-Based Component Security
        1. Web Component Security
        2. EJB Security
      6. Summary
    2. 11. Databases and Database Security
      1. What Is a Database?
      2. Relational Databases
        1. Working with Keys
      3. Structured Query Language
      4. Remote Database Access
        1. ODBC and JDBC Drivers
          1. Microsoft's ODBC
          2. Enter JDBC
      5. Connecting to Databases with the java.sql Package
        1. Setting Up a Database Connection
          1. The DriverManager Class
          2. The Driver Interface
          3. The Connection Interface
        2. Executing SQL Statements
          1. The Statement Interface
          2. The PreparedStatement and CallableStatement Interfaces
        3. The StatementApp Program
      6. Database Security Issues
        1. Securing Database Connections
          1. Using a Dedicated Subnet for Client-Server Communication
          2. Encrypting Communication Between the Database Client and Server
          3. Protecting the Database Client and Server
            1. Using Firewalls
            2. Deploying Intrusion Detection Systems
            3. Hardening the Client and Server Platforms
          4. Authenticating the Client and Server
        2. Securing the User Connection
          1. Authenticating the User
          2. Implementing Access Controls
            1. Implementing Access Controls at the Database Server
            2. Implementing Access Controls at the Database Client
            3. Implementing Access Controls at the Web Server
            4. Implementing Access Controls at the User's Browser
        3. Auditing
        4. Database Scanning
      7. Summary
    3. 12. The Java Authentication and Authorization Service
      1. JAAS Overview
      2. JAAS Subjects
        1. Subject Relationships
        2. Creating Subjects
        3. Manipulating Subject Attributes
        4. Specializing Subject Credentials
      3. Authentication with JAAS
        1. Login Module Configuration and Initialization
          1. Login Context Construction
          2. Login Module Configuration
          3. Login Module Configuration File Location
          4. Login Module Initialization
        2. The Authentication Process
        3. Callback Handling
      4. Authorization with JAAS
        1. JAAS Security Policy File Format
        2. Using JAAS Security Policy Files
        3. Performing Security-Critical Actions
        4. JAAS Security Authorization Abstractions
          1. JAAS Policy Manipulation
          2. Authentication Permissions
          3. Private Credential Permissions
        5. Standard Java Security Policies with JAAS Permissions
      5. Summary
    4. 13. CORBA Security
      1. CORBA Security Overview
        1. CORBA Security Packages
        2. CORBA Security Architecture
        3. Core CORBA Security Interfacing
      2. Authentication
      3. Delegation
      4. Authorization
      5. Auditing
      6. Nonrepudiation
      7. Encryption
      8. Security Policies
      9. Security Administration
      10. Summary
    5. 14. Enterprise JavaBeans Security
      1. EJB Security Overview
      2. Standard Programmatic EJB Access Controls
      3. Standard Declarative EJB Access Controls
      4. Vendor-Specific EJB Access Controls
      5. Vendor-Specific EJB Identity and Authentication
      6. EJB Secure Communications, Delegation, and Auditing
        1. EJB Connection Security
        2. EJB Principal Delegation
        3. EJB Security Auditing
      7. Summary
    6. 15. Java Servlet and JSP Security
      1. The Common Gateway Interface
        1. Web Server-to-CGI Program Communication
        2. CGI Program-to-Web Server Communication
      2. Session State Maintenance
        1. Cookies
        2. URL Rewriting
        3. Hidden Form Fields
      3. Server-Side Programming Security Issues
        1. Interception of Session State Information
        2. Forgery of Session State Information
        3. Buffer Overflow
        4. Data Validation
        5. Page Sequencing
        6. Session Timeout
        7. Information Reporting
        8. Browser Residue
        9. User Authentication
        10. Logging of Sensitive Information
        11. Least Privilege
      4. Java Servlets
        1. Why Servlets?
        2. The Servlet API
          1. The javax.servlet Package
            1. Interfaces
            2. Classes
            3. Exceptions
          2. The javax.servlet.http Package
            1. Interfaces
            2. Classes
          3. The javax.servlet.jsp Package
            1. Interfaces
            2. Classes
            3. Exceptions
          4. The javax.servlet.jsp.tagext Package
            1. Interfaces
            2. Classes
        3. How Servlets Work
        4. Servlet Examples
        5. Servlet Security
          1. User Authentication
          2. Role-based Access Controls
            1. Transmission Security
          3. Adding Security to the Sample Servlets
          4. Container Security Requirements
          5. Programmatic Security
      5. JavaServer Pages
      6. Summary
  9. IV. Appendixes
    1. A. Past Java Security Flaws
      1. JavaScript (February, 1996)
      2. DNS Attack (February, 1996)
      3. Class Loader Implementation Bug (March, 1996)
      4. Verifier Implementation Bug (March, 1996)
      5. URL Name Resolution Attack (April, 1996)
      6. Hostile Applets (April, 1996)
      7. Classloader Attack Variant (May 18, 1996)
      8. Illegal Type Cast Attack (June 2, 1996)
      9. Inconsistency in javakey (December 13, 1996)
      10. Web Spoofing (December, 1996)
      11. Java Versus ActiveX (February 25, 1997)
      12. Virtual Machine Bug (March 5, 1997)
      13. Disclosure of IP Addresses (March 17, 1997)
      14. Signing Flaw (April 29, 1997)
      15. Verifier Bugs (May 16, 1997)
      16. Another Verifier Bug (June 23, 1997)
      17. RSA PKCS1 Risk in SSL (June 26, 1998)
      18. Princeton Classloader Attack (July 22, 1998)
      19. Execution of Unverified Code (March 26, 1999)
      20. Construction of Unverified Classes (April 14, 1999)
      21. Locally Installed Applet Classes (February 2, 2000)
    2. B. The Mathematics of RSA
      1. The Math Behind RSA
        1. The Prime Numbers Are Infinite
        2. Primality Testing
        3. Prime Number Generation
        4. Finding an Encryption Key
          1. Reduced Set of Residues
        5. Calculating d from e, p, and q
          1. Calculating d, Knowing Only e and n
      2. Cryptix and RSA
      3. Encryption and Decryption
      4. Computing and Verifying Signatures
    3. C. Downloading and Installing the JCE
      1. Downloading the JCE
      2. Installing the JCE
      3. Testing Your Installation
    4. D. The Java 2 Security API
      1. The java.security Package
        1. Interfaces
          1. Certificate
          2. Guard
          3. Key
          4. Principal
          5. PrivateKey
          6. PrivilegedAction
          7. PrivilegedExceptionAction
          8. PublicKey
        2. Classes
          1. AccessControlContext
          2. AccessController
          3. AlgorithmParameterGenerator
          4. AlgorithmParameterGeneratorSpi
          5. AlgorithmParameters
          6. AlgorithmParametersSpi
          7. AllPermission
          8. BasicPermission
          9. CodeSource
          10. DigestInputStream
          11. DigestOutputStream
          12. GuardedObject
          13. Identity
          14. IdentityScope
          15. KeyFactory
          16. KeyFactorySpi
          17. KeyPair
          18. KeyPairGenerator
          19. KeyPairGeneratorSpi
          20. KeyStore
          21. KeyStoreSpi
          22. MessageDigest
          23. MessageDigestSpi
          24. Permission
          25. PermissionCollection
          26. Permissions
          27. Policy
          28. ProtectionDomain
          29. Provider
          30. SecureClassLoader
          31. SecureRandom
          32. SecureRandomSpi
          33. Security
          34. SecurityPermission
          35. Signature
          36. SignatureSpi
          37. SignedObject
          38. Signer
          39. UnresolvedPermission
        3. Exceptions
          1. AccessControlException
          2. DigestException
          3. GeneralSecurityException
          4. InvalidAlgorithmParameterException
          5. InvalidKeyException
          6. InvalidParameterException
          7. KeyException
          8. KeyManagementException
          9. KeyStoreException
          10. NoSuchAlgorithmException
          11. NoSuchProviderException
          12. PrivilegedActionException
          13. ProviderException
          14. SignatureException
          15. UnrecoverableKeyException
      2. The java.security.acl Package
        1. Interfaces
          1. Acl
          2. AclEntry
          3. Group
          4. Owner
          5. Permission
        2. Classes
        3. Exceptions
          1. AclNotFoundException
          2. LastOwnerException
          3. NotOwnerException
      3. The java.security.cert Package
        1. Interfaces
          1. X509Extension
        2. Classes
          1. Certificate
          2. CertificateFactory
          3. CertificateFactorySpi
          4. CRL
          5. X509Certificate
          6. X509CRL
          7. X509CRLEntry
        3. Exceptions
          1. CRLException
          2. CertificateEncodingException
          3. CertificateException
          4. CertificateExpiredException
          5. CertificateNotYetValidException
          6. CertificateParsingException
          7. CRLException
      4. The java.security.interfaces Package
        1. Interfaces
          1. DSAKey
          2. DSAKeyPairGenerator
          3. DSAParams
          4. DSAPrivateKey
          5. DSAPublicKey
          6. RSAPrivateCrtKey
          7. RSAPrivateKey
          8. RSAPublicKey
        2. Classes
        3. Exceptions
      5. The java.security.spec Package
        1. Interfaces
          1. AlgorithmParameterSpec
          2. KeySpec
        2. Classes
          1. DSAParameterSpec
          2. DSAPrivateKeySpec
          3. DSAPublicKeySpec
          4. EncodedKeySpec
          5. PKCS8EncodedKeySpec
          6. RSAPrivateCrtKeySpec
          7. RSAPrivateKeySpec
          8. RSAPublicKeySpec
          9. X509EncodedKeySpec
        3. Exceptions
          1. InvalidKeySpecException
          2. InvalidParameterSpecException
      6. The javax.crypto Package
        1. Interfaces
          1. SecretKey
        2. Classes
          1. Cipher
          2. CipherInputStream
          3. CipherOutputStream
          4. CipherSpi
          5. KeyAgreement
          6. KeyAgreementSpi
          7. KeyGenerator
          8. KeyGeneratorSpi
          9. Mac
          10. MacSpi
          11. NullCipher
          12. SealedObject
          13. SecretKeyFactory
          14. SecretKeyFactorySpi
        3. Exceptions
          1. BadPaddingException
          2. IllegalBlockSizeException
          3. NoSuchPaddingException
          4. ShortBufferException
      7. The javax.crypto.interfaces Package
        1. Interfaces
          1. DHKey
          2. DHPrivateKey
          3. DHPublicKey
        2. Classes
        3. Exceptions
      8. The javax.crypto.spec Package
        1. Interfaces
        2. Classes
          1. DESedeKeySpec
          2. DESKeySpec
          3. DHGenParameterSpec
          4. DHParameterSpec
          5. DHPrivateKeySpec
          6. DHPublicKeySpec
          7. IvParameterSpec
          8. PBEKeySpec
          9. PBEParameterSpec
          10. RC2ParameterSpec
          11. RC5ParameterSpec
          12. SecretKeySpec
        3. Exceptions
    5. E. Downloading and Installing the Cryptix JCE 1.2
      1. Downloading the Cryptix 3.1
      2. Installing Cryptix 3.1
      3. Testing Your Installation
    6. F. Using the Keytool
      1. Overview
      2. Keystore Locations
      3. Keytool Commands
        1. The -certreq Command
        2. The -delete Command
        3. The -export Command
        4. The -genkey Command
        5. The -help Command
        6. The -identitydb Command
        7. The -import Command
        8. The -keyclone Command
        9. The -keypasswd Command
        10. The -list Command
        11. The -printcert Command
        12. The -selfcert Command
        13. The -storepasswd Command
      4. The Cacerts Keystore
    7. G. Using the jarsigner Tool
      1. JAR Files
        1. Using the jar Tool
        2. Creating a JAR File
        3. Viewing a JAR File
        4. Extracting the Contents of a JAR File
      2. Signing JAR Files
        1. Using jarsigner to Sign a JAR File
        2. Verifying the Signature of a JAR File
      3. Changing the Applet Security Policy
18.116.239.195