Orapki Utility to Manage Oracle Wallets

The Oracle wallet is a secure place to keep keys and certificates. The Oracle wallet is the part of PKI ( Public Key Infrastructure). There are many ways to manage Oracle wallets. One of the methods is to use orapki utilities. In this note, I will show you some practical examples to use orapki utilities. The other methods can be used for managing wallets are owm GUI tool and mkstore command. These tools will be the subject of another note.

I will explain orapki utility with a sample. Imagine that you want to get service from an https website by using  PL/SQL procedures in Oracle database  ( Although I never advise reaching https services from Oracle databases, in some cases, it is required). And the service provider sent to you certificates.

The First Step:  Create the Oracle Wallet

orapki wallet create -wallet /home1/oracle/wallet –pwd passwd123 -auto_login

With this code, you created a wallet in /home1/oracle/wallet directory with passwd123 password. You should send wallet location and password to the developers because developers will use these parameters in  UTL_HTTP package.

After this command, two files ( which are the wallet)  are created in the wallet location.

rw——- 1 oracle dba 6800 Nov 23 15:42 ewallet.p12
rw——- 1 oracle dba 6877 Nov 23 15:42 cwallet.sso

The Second Step:  Add Certificates

Now put certificates which were sent by service providers into wallet location and add these certificates into the wallet with below command, first add the root certificate.

orapki wallet add -wallet /home1/oracle/wallet  -trusted_cert -cert  “root.cer”  –pwd  passwd123

orapki wallet add -wallet /home1/oracle/wallet  -trusted_cert -cert  “app.cer”  –pwd  passwd123

root.cer and app.cer is the file name of certificates.

If you get below messages after adding the certificate. It means the operation is successful.

Oracle PKI Tool : Version – Production

Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.


The Third Step Check Oracle Wallet

orapki wallet display -wallet /home1/oracle/wallet

With this command, you can see all certificates which are in the wallet.

The Fourth Step Check the https service

Now you can write a small PL\SQL code to check your wallet . Simply the below  code open your wallet by giving the location of wallet and its password and then it makes request to the web service with the wallet. If you get 200 from this code  it means you are successful.

set serveroutput on


lo_req  UTL_HTTP.req;

lo_resp UTL_HTTP.resp;


UTL_HTTP.SET_WALLET (‘file:/home1/oracle/wallet’,’passwd123′);

lo_req := UTL_HTTP.begin_request(‘https://webservice.asmx‘);

lo_resp := UTL_HTTP.get_response(lo_req);





Thanks for reading this note.

Y. Anıl Akduygu









Oracle Security Alert for CVE-2017-10269

Oracle announced a new security Alert CVE-2017-10269  on November 14th, 2017. Oracle strongly recommends applying this patch. This security alert is affecting only the Jolt server within Oracle Tuxedo. Nothing to do with Oracle database or any other products. This vulnerability is remotely exploitable without authentication and therefore its base score is 10.0.

It means it is very critical.

Affected Products in detail is Oracle Tuxedo, versions 11.1.1, 12.1.1, 12.1.3, 12.2.2

The Patch Availability Document is ( Metalink Document )

Oracle Security Alert CVE-2017-10269 Patch Availability Document for Oracle Tuxedo (Doc ID 2326009.1)

This patch solves the problem of below vulnerabilities.

CVE-2017-10269, CVE-2017-10272, CVE-2017-10267, CVE-2017-10278,  CVE-2017-10266

The link for the vulnerability.



Thanks for reading this note.

Anıl Akduygu


Oracle Security Alert CVE-2017-10151

Oracle announced a new security Alert CVE-2017-10151 . This is   affecting only Oracle Identity Manager. Nothing to do with Oracle database or any other products. This vulnerability is remotely exploitable without authentication. Ant it is base score is 10.0.

It means it is very critical.

The Patch Availability Document is Doc ID 2322316.1

( Oracle Security Alert CVE-2017-10151 Patch Availability Document for Oracle Identity Manager (Doc ID 2322316.1)

The workaround is very simple; Just change the password for the user OIMINTERNAL.

If you use Oracle Identitiy Manager use this workaround as soon as possible.


Anıl Akduygu



Oracle Critical Patch Update-October2017

Oracle announced  Critical Patch Update – October 2017 today. More or less this PSU  affects all Oracle Products.The general document that covers all information about October-2017 PSU is found in the Metalink.

Patch Set Update and Critical Patch Update October 2017 Availability Document (Doc ID 2296870.1)

At this note; we will focus on Oracle Database , Oracle WebLogic Server and Mysql products.

Let’s start with Oracle Database;

This PSU contains two important new security fixes for Oracle database. With these vulnerabilities , Oracle database may be exploited over a network without requiring user credentials. The base score of these vulnerabilities is 8.8. If you compare these scores with July-2017 PSU, these scores are low.

Actually , there are 6 new security fixes at this PSU. But I will show only two critical fixes at this note.

Screen Shot 2017-10-18 at 22.15.55

If you want to apply these patches ; you can find them at Metalink

For Oracle Database


For Oracle Database


For Oracle Database


Continue with Oracle Fusion Middleware. The Base score for this product starts from 9.8. It is very high if you compare to Oracle Database. Screen Shot 2017-10-18 at 22.26.30


If you want to install this PSU. You can find patch from Doc ID 2296870.1

Patch number for Oracle WebLogic Server are given below.

Screen Shot 2017-10-18 at 22.28.24

Now go on with MySQL; It is base score is lower than Oracle Database and two of them are criticalScreen Shot 2017-10-18 at 22.32.33

As a result; I advice you to apply this PSU as soon as earlier.

Data Redaction Part – 2 Full Redaction

At this note ; we will start to work on Data Redaction by explaining Full Redaction . If you want to get a brief introduction about Data Redaction ; you can read the first  part of this note.

Let’s start with Full Redaction.

Put in a simple ; in Full Redaction ; The table columns are completely masked.
Numeric columns become 0 and character columns become a space character.

Let’s show it with an example. In the example ; we will redact salary column (SAL) column of  SCOTT.EMP table.  First start our application user. We will use this user to check how SAL column  is redacted.



Now  check the original table. ( The emp table of Scott user ).  Before redaction all columns are visible as you see.




Now by using DBMS_REDACT package we will redact SAL column. Simply by using add_policy procedure we can create a policy and add a column to this policy. The parameters of add_policy procedures are self explained. Therefore I am not given any explanation about these parameters. But the only expression parameter is very important.  The expression parameter should contain a logical expression. If the expression is TRUE, column mentioned in the column_name parameter  will be  redacted. If the expression is FALSE , the column will not redacted. In this example I use a simple logical expression which is ‘1=1’. As you know It is always TRUE. This redacts SAL column for all users ( except users who have EXEMPT REDACTION POLICY privilege – I will explain it in the next note)


Now Check redaction polices by querying REDACTION_POLICIES view.



If you want to query which column is redacted , you can use REDACTION_COLUMNS view.



Lets’s check Data redaction is working on or not. You can check it with  previously created user USERA01. Connect with this user and query; SCOTT.EMPT table

As you see; All SAL column is redacted with 0. As a result ; USERA01 can not see the salary of employees.


I hope that this small example will be a good start for  the Data Redaction. I will explain this subject with examples in the next notes.

You can find all these scripts at github

And one more thing ; If you want to get much more information about Data Redaction; you can read my book . It is written by Turkish language  but the examples will be very beneficial.

Anil Akduygu





Introduction to Data Redaction part -1

Data Redaction option is a part of Oracle Advanced Security.  Oracle Advanced Security ( OAS ) can be used after Oracle version and  it is a licensed product. You do not need to make any special installation to use Oracle Advanced Security. Just there are some database codes ( packages) to use OAS options. In this note and the following notes I will show you can use Data Redaction option of OAS .  First let’s me explain what is Data Redaction and where you can use it.

Data Redaction can bu used for  masking sensitive data by using special security policies. Data is masked at the database level and can not be seen on the network as well. The important point is; you do not need to change your applications to mask data. Data is masked for only special logins which are defined by security policies. Applications can reach data as usual. Data can be seen from applications.  Especially ; This product is used to hide the data when connected from ad-hoc query tools ( like SQLPlus or TOAD ).

With the Data Redaction option, we use one of the following methods to hide data.

Full Redaction :  The table columns are completely masked.
numeric columns become 0 and varchar columns become a space character.

Partial Redaction : Only a certain part of the a column is redacted.
For example, a part of the column is masked with ‘*’ character

Regular Expressions:  It is used to mask  a specific part of the data for character columns of different sizes

Random Redaction:  Depending on the type of colon, the data  is redacted randomly.

No Redaction :  In this type of redaction, there is no change in the data. This redaction is used to test the effect of the redaction on the database performance.

Now I gave a brief introduction on the Data Redaction. On the following notes ; we will work on all these redaction types with examples.


Anıl Akduygu.


Masking Data according to User roles in Oracle Database with Data Redaction

At this note I will show to you how you can mask data according to the role of users by using Data Redaction. Actually I will not explain Data Redaction in detail , I assume that you already know about Data Redaction. But in the future I will give detailed information about Oracle Advanced Security and Data Redaction.

Now in this note we will use Data Redaction to mask data according to session roles. Virtual Private database can be used instead of Data Redaction. I will show it in the another note.

I will explain this subject with a sample. In the sample we have an user which holds data (rep_user) , application user ( app_user which can see all data ) and inq_user ( data will be masked for this user) . At the example; Only users which have a special role (redact_role) can not be affected by data redaction policy.

Let’s build up the environment and create users.

First ;  Create rep_user


Create app_user


Create inq_user and redact_role




We simple create a table with one  column and we mask this column with data redaction.


Insert some data to this table and grant this table to app_user and inq_user


Now app_user and inq_user can select this table as below


Now create Data Redaction policy to hide data


And according to our policy only users with redact_role can not be affected by this policy.

To do this grant redact_role to app_user;



And now app_user can see the masked data but other users( inq_user)  can not reach this data.

Lets’s test it


Masked numeric data can be seen as 0  in Data Redaction ( on default).

As you see we can hide data according to user’s role by using SYS_CONTEXT function. You can change this case according to your needs.

you can reach all scripts from github


Anıl Akduygu