Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Authenticate PrivateKey file data from DB instead on Physical Private key by passing Path. #236

Open
BPKReddy opened this issue May 21, 2024 · 1 comment

Comments

@BPKReddy
Copy link

I'm trying to connect "OCI Object Storage" from .Net Application. Currently able to connect with providing PrivateKey file path and "PrivateKey File" available in Physical path. All other values are coming from the Database.

Due to security reasons, I cannot have a physical "PrivateKey" file on the server. Need to maintain PrivateKey file content also in the Database and Authenticate. I'm fine with storing PrivateKey file content as a string in DB or storing "PrivateKey file" as BLOB. Then read "PrivateKey" from DB and build SimpleAuthenticationDetailsProvider object.

please suggest me how can I read "PrivateKey file content" from a Variable or File object.

var provider = new SimpleAuthenticationDetailsProvider
{
TenantId = "ocid1.tenancy",
UserId = "ocid1.user",
Fingerprint = "Fingerprint Value",
Region = Region.FromRegionId("us-ashburn-5"),
PrivateKeySupplier = new FilePrivateKeySupplier("C:\Pavan\PrivateKey\customer-3_2024-03-19T07_58_29.636Z.pem", new SecureString()),
};

@nghianguyen09
Copy link

@BPKReddy

you just simply pass the content of private key file as string as sample code below

string privateKey = "private key content from DB";
var provider = new SimpleAuthenticationDetailsProvider
{
  //....
  PrivateKeySupplier = new PrivateKeySupplier(privateKey)
}

Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants