jeroen / bcrypt

Wrapper for bcrypt in R
Other
18 stars 0 forks source link

bcrypt incompatible with cloudyr/aws.s3 #3

Open dylancis opened 6 years ago

dylancis commented 6 years ago

The bcrypt library causes aws.s3 to fail for requests once this is loaded. Restart your R session and try:

library(aws.s3)  # https://github.com/cloudyr/aws.s3
# library(bcrypt)  # commented on prupose
# config file
appSpecs <- yaml::yaml.load_file("config/app_specs.yaml")
# a3 secret keys
Sys.setenv("AWS_ACCESS_KEY_ID" = appSpecs$awsAccessKey, "AWS_SECRET_ACCESS_KEY" = appSpecs$awsSecretKey)
put_object(file = "global.R", bucket = "dbrs-model-eurmbsinsight-staging-qa", object = "test.txt", check_region = FALSE)

Result is OK:

put_object(file = "global.R", bucket = "dbrs-model-eurmbsinsight-staging-qa", object = "test.txt", check_region = FALSE) [1] TRUE

Now restart again your R session:

library(aws.s3)  # https://github.com/cloudyr/aws.s3
library(bcrypt)  # now enabled
# config file
appSpecs <- yaml::yaml.load_file("config/app_specs.yaml")
# a3 secret keys
Sys.setenv("AWS_ACCESS_KEY_ID" = appSpecs$awsAccessKey, "AWS_SECRET_ACCESS_KEY" = appSpecs$awsSecretKey)
put_object(file = "global.R", bucket = "dbrs-model-eurmbsinsight-staging-qa", object = "test.txt", check_region = FALSE)

Result is KO:

put_object(file = "global.R", bucket = "dbrs-model-eurmbsinsight-staging-qa", object = "test.txt", check_region = FALSE) Error in curl::curl_fetch_memory(url, handle = handle) : schannel: next InitializeSecurityContext failed: SEC_E_DECRYPT_FAILURE (0x80090330) - The specified data could not be decrypted.

luc-kalaora commented 4 years ago

Hi, i have also an error on windows 10 when using bcrypt with aws.S3 : Error in curl::curl_fetch_memory(url, handle = handle) : Timeout was reached: Resolving timed out after 10000 millisecond A Window Error also appears : The procedure entry point BCryptFinishHash could not be located in the dynamic link library c:\windows\System32\fwpuclnt.dll Here is the code :

library(bcrypt)
library(aws.s3)
aws = read.csv2(paste0("credentials.csv"), sep=";", stringsAsFactors = FALSE)
Sys.setenv("AWS_ACCESS_KEY_ID" = aws$Access.key.ID[1],"AWS_SECRET_ACCESS_KEY" = aws$Secret.access.key[1],"AWS_DEFAULT_REGION" = "eu-central-1")
questions = s3readRDS(bucket="bucket_name", object="object_path") 

SessionInfo :

R version 3.6.1 (2019-07-05) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] aws.s3_0.3.12 bcrypt_1.1

loaded via a namespace (and not attached): [1] httr_1.4.1 compiler_3.6.1 R6_2.4.0 tools_3.6.1 base64enc_0.1-3
[6] curl_4.0 yaml_2.2.0 Rcpp_1.0.2 aws.signature_0.5.2 xml2_1.2.2
[11] digest_0.6.20 openssl_1.4.1 askpass_1.1

Traceback :

12: curl::curl_fetch_memory(url, handle = handle) 11: request_fetch.write_memory(req$output, req$url, handle) 10: request_fetch(req$output, req$url, handle) 9: request_perform(req, hu$handle$handle) 8: GET(url, H, query = query, ...) 7: s3HTTP(verb = "GET", bucket = bucket, query = list(location = ""), check_region = FALSE, ...) 6: get_location(bucket = x, ...) 5: get_region.default(x = bucket, key = key, secret = secret, session_token = session_token, ...) 4: get_region(x = bucket, key = key, secret = secret, session_token = session_token, ...) 3: s3HTTP(verb = "GET", bucket = bucket, path = paste0("/", object), headers = headers, write_disk = httr::write_disk(path = file, overwrite = overwrite), ...) 2: save_object(bucket = bucket, object = object, file = tmp, ...) 1: s3readRDS(bucket = "bucket_name", object = "object_path")

Thanks for your help