Add regex and tests for PEM formatted private key#179
Merged
bee-san merged 1 commit intobee-san:mainfrom Oct 8, 2021
Merged
Conversation
bee-san
reviewed
Oct 7, 2021
pywhat/Data/regex.json
Outdated
| "Name": "PEM-formatted Private Key", | ||
| "Regex": "^(-----BEGIN( ANY| RSA| DSA| ENCRYPTED| EC| OPENSSH)? PRIVATE KEY-----\\n?[a-zA-Z0-9\\/\\.\\n\\:\\+\\=]+-----END( ANY| RSA| DSA| ENCRYPTED| EC| OPENSSH)? PRIVATE KEY-----)$", | ||
| "plural_name": false, | ||
| "Description": "Textual encoding of Public-Key Cryptography Standards (PKCS) described in RFC7468. Some of these PEM headers are defined in OpenSSL in https://github.com/openssl/openssl/blob/master/include/openssl/pem.h", |
Collaborator
There was a problem hiding this comment.
I don't think so. If a user wants to get this additional info they can easily search for it. What do you think?
Contributor
Author
There was a problem hiding this comment.
should i change it or what should i do? sorry first time contributing, don't know how to proceed 🙂
Collaborator
There was a problem hiding this comment.
Hi! We think it is not needed, so you can remove it yes. Replace it with null :)
56fde4b to
b8420f2
Compare
bee-san
approved these changes
Oct 8, 2021
bee-san
requested changes
Oct 8, 2021
pywhat/Data/regex.json
Outdated
| "Rarity": 1, | ||
| "URL": null, | ||
| "Tags": [ | ||
| "Credentials" |
Owner
There was a problem hiding this comment.
Can we add the tag "Bug Bounty" here too please?
The regex will match private key generated by ssh-keygen and those defined by OpenSSL header file. The regex, however, doesn't validate if the string within BEGIN and END label is "correct" Base64 encoded. As it can be validated be direct checking with the public key Resolves: bee-san#174
c51f38f to
6ae7cfe
Compare
bee-san
approved these changes
Oct 8, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The regex will match private key generated by ssh-keygen and those
defined by OpenSSL header file. The regex, however, doesn't validate if
the string within BEGIN and END label is "correct" Base64 encoded. As it
can be validated be direct checking with the public key
Resolves: #174