Showing posts with label compatible. Show all posts
Showing posts with label compatible. Show all posts

Tuesday, May 27, 2008

Learn EDB: Basic Encryption

LewisC's An Expert's Guide To Oracle Technology


An ITToolbox user recently asked a question on the EnterpriseDB discussion group, Oracle equilant UTL_I18N.STRING_TO_RAW IN ENTERPRISEDB.


Basically, Sreenivas asked which functions in EnterpriseDB could be used to implement dbms_crypto, hex_to_raw, string_to_raw, etc. I believe he is using EnterpriseDB Postgres Plus Advanced Server which is the product that gives Oracle Compatibility. The short answer to his question is that right now, there are no compatibility functions for those. The long answer is that you can re-implement that functionality using native PG functionality.


If you look at Sreenivas's message you can see how his existing code works. I posted a simple example in response which I am reposting below. The PG docs suggest that you use PGP based encryption rather than what they call raw encryption. I think it depends on exactly what you're doing, personally. Anyway, raw encryption was closer to what Sreenivas was doing so that was what I based my example on.


I've used DBMS_CRYPTO in Oracle quite a bit but this is my first use of encrypt/decrypt in PG. If you have any suggestions for improving it, I'd like to hear them.


Hi Sreenivas,




I saw your post on the edb forum but and planned to write a blog entry on this topic.


The thing is that there isn't a one to one translation in EDB yet. The easiest thing is to rewrite your procedure and use built-ins that are available.




It is recommended that you use the PGP function in postgres as opposed to the raw encryption functions for better security. However, raw encryption more closely matches what you are trying to do. Below is an example of using raw encryption with AES.


You don't need to convert to hex as you'll be using bytea which is easily converted from and to a string. If you really need international support, check out the pg decode function (which is different from Oracle's decode). http://www.postgresql.org/docs/current/static/funct ions-string.html




Here is a very simple example that you can use to build your procedure:



declare

original_data text := 'I am going to be encrypted';
data bytea;
cipher bytea;
crypto_type text;
encrypted_data bytea;
final_string text;

begin

-- conversion to bytea, could use cast too
data := original_data;

--set cipher key
cipher := 'not a strong key, use pgp instead';

-- select type: aes or blowfish (bf)
crypto_type := 'aes';

-- encrypt the data
select encrypt(data, cipher, crypto_type) into encrypted_data;

dbms_output.put_line('Encrypted: ' || encrypted_data );

-- decrypt the data
select decrypt(encrypted_data, cipher, crypto_type) into final_string;

dbms_output.put_line('Decrypted: ' || final_string );

end;

Hope this helps,


LewisC




Del.icio.us : , , ,

Tuesday, December 25, 2007

Compatibility Between EntepriseDB and Oracle

Have you wondered what features are compatible between Oracle and EnterpriseDB? Have you wondered if EnterpriseDB is REALLY compatible with Oracle?

EnterpriseDB has compiled a new document called the Oracle Compatibility Developer's Guide. You can download the Oracle Compatibility Developer's Guide for EntepriseDB 8.2 or the Oracle Compatibility Developer's Guide for 8.3 Beta.

This new document should help answer one of the most common questions I get asked, i.e., what is compatible and what is not compatible between EnterpriseDB and Oracle. If you are interested in EnterpriseDB but haven't taken the plunge, check out this document.

Speaking of compatibility, I plan to start a series of articles that directly compares a feature between Oracle and EntepriseDB (with mentions to pure PostgreSQL).

LewisC




Sunday, November 18, 2007

EDB*Plus and EDB*Loader Emulate Oracle’s SQL*Plus and SQL*Loader: EnterpriseDB 8.3 Beta

EnterpriseDB Advanced Server’s enterprise-class, cross-platform developer and DBA console now includes EDB*Plus, a command-line terminal interface that emulates Oracle’s SQL*Plus. Like SQL*Plus, EDB*Plus allows users to run SQL and PL/SQL commands interactively. Oracle users accustomed to SQL*Plus will find EDB*Plus immediately familiar. In addition, EnterpriseDB’s new EDB*Loader emulates Oracle’s SQL*Loader and provides even deeper compatibility.

EnterpriseDB Advanced Server 8.3 adds several new features that enhance the database’s ability to run, unchanged, applications written for Oracle. For example, there are more than 20 new Oracle-compatible system views, Oracle-compatible packages now support comments, and ROWNUM can now be used in sub-queries and views. In addition, EnterpriseDB’s new bulk binding feature, which allows collections of SQL statements to be collected and run together to improve performance, further improves Oracle compatibility.

Other updates to the new software include:

  • A DBA monitoring console that provides real-time charting for CPU and memory usage, disk I/O, and cache hit ratios across multiple EnterpriseDB databases
  • Support for embedded hints, which can alter program execution
  • Transaction error recovery support, which enables implicit statement-level transactions
  • Updateable cursors
  • Definer/invoker rights to provide controlled access to database objects



Software Blogs - Blog Catalog Blog Directory Software blogs Top Blog Sites Blog Flux Directory Lewis Cunningham