I have a server_password
column in my table server_services
.
I'm using a package to encrypt/decrypt the password.
This sometimes fails with an internal Oracle error message and is what I am investigating. I believe the error message is oracle's way of telling me the password or encrypted value is wrong.
The password is stored in a type VARCHAR2(100 BYTE)
column; the encode/decode functions work with utl_raw.cast_to_raw
and utl_raw.cast_to_varchar2
and take and give a varchar2.
When looking at the password, it is looking strange, with many boxes indicating non-printable characters.
Now my problem is that the decryption works, but then starts failing. To investigate this, I calculated a hash of the encrypted password:
select rawtohex(
DBMS_CRYPTO.Hash (
UTL_I18N.STRING_TO_RAW (SERVER_PASSWORD, 'AL32UTF8'),
2)
)
FROM SERVER_SERVICES;
What is strange is that suddenly the hash changes, and there is no code that is supposed to do that. And I'm also not touching the table data manually.
-- doesn't work:
-- D40D0635FAC75F47DE5164F0EF50A2DB
-- regenerated password
-- works
-- 41136DFB85EFEDAC08150A8959923422
-- waited some time
-- doesn't work again
-- D40D0635FAC75F47DE5164F0EF50A2DB
Do you have any idea what is causing this and how to prevent it?
The oracle error message and code:
ORA-06512: at "SYS.DBMS_CRYPTO_FFI", line 67
ORA-06512: at "SYS.DBMS_CRYPTO", line 44
ORA-06512: at "XXX_CONFIGURATION.ENCRYPT_DECRYPT_PASSWORD", line 32
ORA-06512: at "XXX_CONFIGURATION.ENCRYPT_DECRYPT_PASSWORD", line 65
ORA-06512: at line 1
I tried to look at the package, but it is "wrapped":
"PACKAGE BODY dbms_crypto_ffi wrapped
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
b
228a 312
2L+V7+Eg9BLQ+XmmDXawGjt9NCkwg811r9yGfC9ArU6O79zKUmj9ScZSugr0ScKkyrBaaS8K
RM2eU4oiAJ+r4d4lezkNE6wQ5Yqan2461E6wiGvHZQEvOHHdBvzuJjQ/5PjBOr9CEvi243t6
Nusbvg7sjKYbTVZlssZ/s90CpB2h0dzVXMQpZhJcAfTFvlB+l117gW6UHTxdwaXcMgkKFOu+
jmGw/I+etGPJCcg2NqGIdnOS/tLPTjDD8Mmi7CKC2I91UUJNDFVV10G4Y6hD7Sg8Wr7jrWyr
bE19xjlMFdvDcopkNK4XDwXyXv0yShDNbaQwiWB79aHGzH6gOUhVWqS6eHvGPCrT/4GrTPbt
bFS90BT3RMN3Cybzt62xAVVModFTWF5e9WFZnFlmAVLRMZjPzFy8cOI1ypXYqRavEaSGDhQQ
As+M/5avOclUIBg7+k0ST18JEIgBSpxwlEG5dPir5MlGdwiukLMO3PDLfUdLorLyDnU5Zhjx
5d2qj6rP5MQ7zEeDPIV5bUC6ZsSkmw3mbXACrJSDJpQj2dBk3gJva4421V2iVZoGNvkdtRLJ
AsmiXJk/hZ5CMXWYICcL+Q81D/1dLpzrF4zPtSkWu5tRBDi4NNnc47Qz7zzLk/KnREgMmtCH
7hLnDweY0QjvUyF750ixx+IvKebAnUiJZwkHGqS1mP2lkvIwDTrxott1qzSiQTMvBlwez/KQ
VUhaBP1VHM7LGFfBfna8hnu0SiD311nbL4AmxR4+t70k2jD7+XS+Vg==
"