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

Feature/permanent keys storage #28

Merged
merged 62 commits into from
Aug 25, 2019
Merged

Conversation

shuffle-c
Copy link
Collaborator

Implemented new Windows Credential Manager storage (#7)

@shuffle-c shuffle-c requested a review from sirAndros August 25, 2019 22:24
default:
throw new ExternalException("External error occurred", value);
ngcKeyHandle.Close();
DeletePersistentKey();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мб не переоткрывать хэндл, а вызвать напрямую NCryptDeleteKey


int cacheType = 0;
NCryptGetProperty(ngcKeyHandle, NCRYPT_NGC_CACHE_TYPE_PROPERTY, ref cacheType, sizeof(int), out pcbResult, CngPropertyOptions.None).CheckStatus();
if (cacheType == 0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment "zero" meaning

{
_randomSeedBits = 256;
_encryptionIV = CryptoRandom.Instance.GetRandomBytes(16);
_encryptionIV = new byte[16];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be const initial value (no all zero)

long lowDateTime = (uint)ncred.LastWritten.dwLowDateTime;

var createdDate = DateTime.FromFileTime(highDateTime | lowDateTime);
if (DateTime.Now - createdDate >= Settings.Instance.InvalidatingTime)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think about Utc

@sirAndros sirAndros merged commit 718381e into master Aug 25, 2019
@sirAndros sirAndros deleted the feature/permanent-keys-storage branch August 16, 2021 00:17
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

Successfully merging this pull request may close these issues.

None yet

2 participants