Skip to content

Unable to encrypt .pem file? #131

Closed
Closed
@ddmee

Description

@ddmee

Hi, I've been trying to encrypt a certificate with transcrypt.

Let's say I have a certificate file in my git repo at <repo>/cert.pem

—–BEGIN PRIVATE KEY—–
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDBj08sp5++4anG
cmQxJjAkBgNVBAoTHVByb2dyZXNzIFNvZnR3YXJlIENvcnBvcmF0aW9uMSAwHgYD
VQQDDBcqLmF3cy10ZXN0LnByb2dyZXNzLmNvbTCCASIwDQYJKoZIhvcNAQEBBQAD
…
bml6YXRpb252YWxzaGEyZzIuY3JsMIGgBggrBgEFBQcBAQSBkzCBkDBNBggrBgEF
BQcwAoZBaHR0cDovL3NlY3VyZS5nbG9iYWxzaWduLmNvbS9jYWNlcnQvZ3Nvcmdh
z3P668YfhUbKdRF6S42Cg6zn
—–END PRIVATE KEY—–

If I add the file to transcrypt via gitattributes, when I try to commit the file I get the warning

Transcrypt managed file is not encrypted in the Git index: cert.pem

You probably staged this file using a tool that does not apply .gitattribute filters as required by Transcrypt.

Fix this by re-staging the file with a compatible tool or with Git on the command line:

    git reset -- cert.pem
    git add cert.pem

Using #120 git rm --cached cert.pem doesn't fix the problem.

I guess transcrypt must think that the certificate file is already encrypted? As it seems to be hitting these lines of code:

transcrypt/transcrypt

Lines 224 to 226 in fdf81c5

# The first bytes of an encrypted file must be "Salted" in Base64
elif [[ $firstbytes != "U2FsdGVk" ]]; then
printf 'Transcrypt managed file is not encrypted in the Git index: %s\n' "$secret_file" >&2

But the certificate file isn't encrypted. I'm wondering can transcrypt encrypt certificate files?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions