Chapter 3
Chapter 3
Chapter 3
Introduction
• Integrity refers to unauthorized access to the database.
• Data integrity refers to validity, consistency, correctness and accuracy of the data in
database and represented in terms of integrity constraints.
• Database security refers to confidentiality, integrity, and availability of the data stored in
database.
• Database security protects the data from unauthorized access
Domain integrity constraint:
• The domain integrity constraint are used to specify the valid values that column defined
over the domain can take.
• This constraint determines appropriate data type for column.
• The data type of domain includes string, character, integer, time, date, currency, etc. The
value of the attribute must be available in the corresponding domain.
Check constraint – It relates to the set of values that can be specified in an attribute of a
relation. It specifies that every valid value in an attribute should satisfy a given condition. Eg.
Account balance should be greater than zero, Mobile number should be of 10 digits.
Entity integrity constraints - For Primary key attribute value should not be NULL
• e.g – Student
• (NULL, “Joshi”, 20)
• (NULL, “Joshi”, 21)
Referential integrity constraints-
• It is specified between two relations. This constraint states that a tuple in one relation that
refers to another relation must refer to an existing type in that relation. To define
referential integrity we define concept of a foreign key.
• e.g In case of dept-emp there is association as in One department there can be many
employees. This can be indicated using foreign key concept.
• Discretionary access control (also called security scheme) is based on the concept of
access rights (also called privileges) and mechanism for giving users such privileges.
• It grants the privileges (access rights) to users on different objects, including the
capability to access specific data files, records or fields in a specified mode, such as, read,
insert, delete or update or combination of these.
• A user who creates a database object such as a table or a view automatically gets all
applicable privilege on that object. The DBMS keeps track of how these privileges are
granted to other users.
• Discretionary security schemes are very flexible.
GRANT Command:
• Mandatory access control (also called security scheme) is based on system-wide policies
that cannot be changed by individual users.
• It is used to enforce multi-level security by classifying the data and users into various
security classes or levels and then implementing the appropriate security policy of the
organization.
• Thus, in this scheme each data object is labelled with a certain classification level and
each user is given a certain clearance level.
• A given data object can then be accessed only by users with the appropriate clearance of
a particular classification level.
• Thus, a mandatory access control technique classifies data and users based on security
classes such as top secret (TS), secret (S), confidential(C), Unclassified(U).
• TS is highest level and U the lowest.
TS >= S >= C >= U
• For example, let’s consider data that has the “top secret” confidentiality level and
“engineering project” security label. It’s available to a set of users that have “top secret”
clearance and authorization to access engineering documents. Such users can also access
information that requires a lower level of clearance. But employees with lower levels of
clearance will not have access to information that requires a higher level of clearances
Role based access control for multilevel security:
• Roles are a collection of privileges or access rights.
• When there are many users in a database it becomes difficult to grant or revoke privileges
to users.
• You can either create Roles or use the system roles pre-defined by oracle.
• Some of the privileges granted to the system roles.
• It's easier to GRANT or REVOKE privileges to the users through a role rather than
assigning a privilege directly to every user.
• If a role is identified by a password, then, when you GRANT or REVOKE privileges to
the role, you definitely have to identify it with the password.
• Example:
To grant CREATE TABLE privilege to a user by creating a testing role.
-> CREATE ROLE testing;
Grant a CREATE TABLE privilege to the ROLE testing.
-> GRANT CREATE TABLE TO testing;
Grant the role to a user.
-> GRANT testing TO user1;
Revoke a CREATE TABLE privilege from testing ROLE.
-> REVOKE CREATE TABLE FROM testing;
To drop a role from the database.
-> DROP ROLE testing;
Overview of encryption technique for security:
• “Masks” data for secure transmission or storage.
⮚ Encrypt(data, encryption key) = encrypted data
⮚ Decrypt(encrypted data, decryption key) = original data
⮚ Without decryption key, the encrypted data is meaningless
• Symmetric Encryption:
⮚ Encryption key = decryption key; all authorized users know decryption key (a
weakness).
⮚ DES, used since 1977, has 56-bit key; AES has 128-bit (optionally, 192-bit or
256-bit) key
• Asymmetric or Public-Key Encryption: Each user has two keys:
⮚ User’s public encryption key: Known to all
⮚ Decryption key: Known only to this user
⮚ Used in RSA scheme
RSA Public-Key Encryption:
• Let the data be an integer I
• Choose a large (>> I) integer L = p * q
⮚ p, q are large, say 1024-bit, distinct prime numbers
• Encryption: Choose a random number 1 < e < L that is relatively prime to (p-1) * (q-1)
⮚ Encrypted data S = I e mod L
• Decryption key d: Chosen so that
⮚ d * e = 1 mod ((p-1) * (q-1))
⮚ We can then show that I = S d mod L
• It turns out that the roles of e and d can be reversed; so they are simply called the public
and private keys
Statistical DB Security:
• Statistical databases are used mainly to produce statistics about various populations.
• The database may contain confidential data about individuals, which should be protected
from user access.
• However, users are permitted to retrieve statistical information about the populations,
such as averages, sums, counts, maximums, minimums, and standard deviations.
• Statistical queries involve applying statistical functions to a population of tuples.
• Example - We may want to retrieve the number of individuals in a population or the
average income in the population.
• However, statistical users are not allowed to retrieve individual data, such as the
income of a specific person.
• Statistical database security techniques must prohibit the retrieval of individual data. This
can be achieved by prohibiting queries that retrieve attribute values and by allowing only
queries that involve statistical aggregate functions such as COUNT, SUM, MIN, MAX,
AVERAGE, and STANDARD DEVIATION. Such queries are sometimes called
statistical queries.