Giter Club home page Giter Club logo

buildcrx's People

Contributors

darkpixel avatar kylehuff avatar m417z avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

alex-secure aa333

buildcrx's Issues

Support for Encrypted PEM

This is a request for support for password protected PEMs.

You'd have to call PEM_read_RSAPrivateKey with a pem_password_cb and supply it the password through userdata.

printf( "usage: %s <ZIP file> <PEM file> <PEM password or \"NULL\"> (optional <OUTPUT PATH/FILE>)\n", argv[0] );

int password_cb(char *buf, int size, int rwflag, void *userdata)
{
     strcpy(buf, (char *)userdata);
     return strlen(buf);
}

if (strcmpi(argv[3], "") == 0 || strcmpi(argv[3], "NULL") == 0)
    privateKey = PEM_read_RSAPrivateKey (pemfile, NULL, NULL, NULL);
else
    privateKey = PEM_read_RSAPrivateKey (pemfile, NULL, password_cb, argv[3]);

garbage chars in status output on Windows

Hi Kyle - any idea why I get those three garbage characters after 'WebCapture' in the output copy/pasted below?
The resulting .crx seems to be accepted by Chrome without complaint.
Oddly, I seem to only see these when running buildcrx from the 'dos box', not when it runs from my .bat file.

c:\build\DotTwain\firefox-plugin\build\bin\WebCapture\MinSizeRel>buildcrx WebCapture.zip WebCapture.pem
Bulding a test ZIP file
strcat: WebCapture▄■(.crx
Extension name is WebCapture.zip, and will be WebCapture▄■(.crx
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC73IWLPvyPexoIWwmKV+Yz2Qti
XfQ0AFKjzyYy7DlWTtsfO6MJXwqt5JpCRSuSFK3/6KaG14k4uJrOe8H1tRLNQnok
AZBdzviF+s8Og8Y6qbA0PDxqjofqIQrQp8uSi6EtSxVqoz04nXyI9OChboGCvRaI
Wh5rcbVoxZtKdxNhaQIDAQAB
-----END PUBLIC KEY-----
Content Size: 1417742 (1384.51 KB)
RSA Keysize: 128, RSA (DER) size: 162
Signature Size: 128
Saved extension to WebCapture▄■(.crx

Print out AppID

It would be great if the tool could also print out the extension's app id. Here is some code that I have scratched together real quick to do just that.

bool hexencode(char* buf, int size, char *target, int maxtarget) {
    static const char hexChars[] = "0123456789ABCDEF";
    int i = 0;
    for (i = 0; i < size; ++i) {
        target[(i * 2)] = hexChars[(buf[i] >> 4) & 0xf];
        target[(i * 2) + 1] = hexChars[buf[i] & 0xf];
    }
    return true;
}

void hextoidalpha(char* id, int idsize) {
    char x[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
    for (size_t i = 0; i < idsize; ++i) {
        id[i] = x[id[i]-'0'] + 'a';
    }
}

void generate_appid(char *buf, int size, char out[SHA256_DIGEST_LENGTH]) {
    SHA256_CTX sha;
    byte digest[SHA256_DIGEST_LENGTH];
    char hexDigest[SHA256_DIGEST_LENGTH * 2] = {0};
    SHA256_Init(&sha);
    SHA256_Update (&sha, buf, size);
    SHA256_Final(digest, &sha);
    hexencode((char *)digest, SHA256_DIGEST_LENGTH, hexDigest, SHA256_DIGEST_LENGTH*2);
    hextoidalpha(hexDigest, SHA256_DIGEST_LENGTH);
    strncpy(out, hexDigest, SHA256_DIGEST_LENGTH);
}

Then in main function after you convert the RSA PublicKey to DER format

    // Print the appid
    char appid[SHA256_DIGEST_LENGTH] = {0};
    generate_appid((char *)derkey,derlen,appid);
    printf("appid: %.32s\n", appid);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.