Print the cipher PRAGMA when context exists
This commit is contained in:
parent
273558efc6
commit
693a403f76
@ -94,8 +94,12 @@ int codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLeft, const c
|
||||
if( sqlite3StrICmp(zLeft, "cipher_version")==0 && !zRight ){
|
||||
codec_vdbe_return_static_string(pParse, "cipher_version", codec_get_cipher_version());
|
||||
}else
|
||||
if( sqlite3StrICmp(zLeft, "cipher")==0 && zRight ){
|
||||
if(ctx) sqlcipher_codec_ctx_set_cipher(ctx, zRight, 2); // change cipher for both
|
||||
if( sqlite3StrICmp(zLeft, "cipher")==0 ){
|
||||
if( zRight ) {
|
||||
if(ctx) sqlcipher_codec_ctx_set_cipher(ctx, zRight, 2); // change cipher for both
|
||||
}else {
|
||||
if(ctx) sqlcipher_codec_ctx_get_cipher(pParse, ctx, 2);
|
||||
}
|
||||
}else
|
||||
if( sqlite3StrICmp(zLeft, "rekey_cipher")==0 && zRight ){
|
||||
if(ctx) sqlcipher_codec_ctx_set_cipher(ctx, zRight, 1); // change write cipher only
|
||||
|
||||
@ -344,6 +344,15 @@ int sqlcipher_codec_ctx_set_cipher(codec_ctx *ctx, const char *cipher_name, int
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
int sqlcipher_codec_ctx_get_cipher(Parse *pParse, codec_ctx *ctx, int for_ctx) {
|
||||
cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;
|
||||
EVP_CIPHER *evp_cipher = c_ctx->evp_cipher;
|
||||
char* name = EVP_CIPHER_name(evp_cipher);
|
||||
codec_vdbe_return_static_string(pParse, "cipher", name);
|
||||
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
int sqlcipher_codec_ctx_set_kdf_iter(codec_ctx *ctx, int kdf_iter, int for_ctx) {
|
||||
cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;
|
||||
int rc;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user