• 0 Posts
  • 30 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle


  • ShortFuse@lemmy.worldtolinuxmemes@lemmy.world-----BEGIN PRIVATE KEY-----
    link
    fedilink
    arrow-up
    15
    arrow-down
    1
    ·
    edit-2
    2 months ago

    Yeah, except for the first few bytes. PKCS8 has some initial header information, but most of it is the OCTET_STRING of the private key itself.

    The PEM (human “readable”) version is Base64, so you can craft up a string and make that your key. DER is that converted to binary again:

    /**
     * @see https://datatracker.ietf.org/doc/html/rfc5208#section-5
     * @see https://datatracker.ietf.org/doc/html/rfc2313#section-11
     * Unwraps PKCS8 Container for internal key (RSA or EC)
     * @param {string|Uint8Array} pkcs8
     * @param {string} [checkOID]
     * @return {Uint8Array} DER
     */
    export function privateKeyFromPrivateKeyInformation(pkcs8, checkOID) {
      const der = derFromPrivateKeyInformation(pkcs8);
      const [
        [privateKeyInfoType, [
          [versionType, version],
          algorithmIdentifierTuple,
          privateKeyTuple,
        ]],
      ] = decodeDER(der);
      if (privateKeyInfoType !== 'SEQUENCE') throw new Error('Invalid PKCS8');
      if (versionType !== 'INTEGER') throw new Error('Invalid PKCS8');
      if (version !== 0) throw new Error('Unsupported PKCS8 Version');
      const [algorithmIdentifierType, algorithmIdentifierValues] = algorithmIdentifierTuple;
      if (algorithmIdentifierType !== 'SEQUENCE') throw new Error('Invalid PKCS8');
      const [privateKeyType, privateKey] = privateKeyTuple;
      if (privateKeyType !== 'OCTET_STRING') throw new Error('Invalid PKCS8');
      if (checkOID) {
        for (const [type, value] of algorithmIdentifierValues) {
          if (type === 'OBJECT_IDENTIFIER' && value === checkOID) {
            return privateKey;
          }
        }
        return null; // Not an error, just doesn't match
      }
    
      return privateKey;
    }
    

    I wrote a “plain English” library in Javascript to demystify all the magic of Let’s Encrypt, ACME, and all those certificates. (Also to spin up my own certs in NodeJS/Chrome).

    https://github.com/clshortfuse/acmejs/blob/96fcbe089f0f949f9eb6830ed2d7bc257ea8dc32/utils/certificate/privateKeyInformation.js#L40

    Edit: To be specific, PKCS8 is usually a PKCS1 (RSA) key with some wrapping to identify it (the OID). The integers (BigInts) you pick for RSA would have to line up in some way, but I would think it’s doable. At worst there is maybe a character or two of garbage at the breakpoints for the RSA integers. And if you account for which ones are absent in the public key, then anybody reading it could get a kick out of reading your public certificate.


  • There is no section 15 or 16 in GPLv3, but I did find section 7 saying:

    Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or

    But that’s an optional thing that you must add onto the GPLv3 license. I’ll have to keep that in mind for the future.

    That would explain why what I’ve read mentioned it’s not guaranteed in GPLv3 (when comparing to MIT). I’ll have to figure out what that notice would look like.



  • I don’t care if people make money to use my code. I just want my name attached to it somehow, even if you make it closed sourced which is MIT and OpenBSD. I hope you do use my code and even if you heavily reference it to make something new, carry that forward so more can learn and benefit.

    I also don’t understand “better for the end user” arguments either. I have a library that people want to be included in another project, but that project is GPL. They won’t merge my code unless I change my code to be GPL. So everyone who wants them merged is out of luck. I can’t merge their code either with mine. What is supposed to happen is I freely give up my name to the code and restrict it to only being GPL and for GPL projects. Essentially, assimilate and join with the Borg. No, thanks.

    And while that’s from my experience, I’ve also seen good projects get traction, have excitement over it, and fall off the earth because they end up making it GPL. Everyone interested in adopting it, personal or business, just disappear. Then something with less restrictions comes along and gets adopted.

    End-users move to what’s better for them, and if you have a library that is only for GPL, you can end up limiting your options with a wasteful purity test. If you want it to be free you’d give freely with no restrictions. And if you think, “You can contact me to discuss licensing” that doesn’t happen. It’s still a restriction and almost nobody actually bothers.







  • Maybe I misunderstood the point of data, but I was making the point that they don’t need to perform complex tracking or rely on non-anonymized data. Invading privacy isn’t a very important part of their business model. People still freely feed them data either directly (captcha with OCR scan or Street View images; adding location reviews, photos, and details; YouTube likes and subscriptions) or indirectly (searches and links you click after; YouTube views; places you navigate to and what time; your location when you request navigation directions).

    The tagging of data around specific people (privacy) which the EU is very concerned about, I feel, is grossly overemphasized. Just counters on what gets pinged and when on a transactional basis is very much good enough for Google’s business model.


  • As you continue to use their services you are shown ads or use services other companies have paid to have linked to. Even when things seem “free” they are never free. Google Maps makes money off charging their API for businesses. They charge what they do because their data quality is high. Their data quality is high because they track usage as well as ask users to improve their data (like ask if a restaurant has table service). Every time you search for a business or call a business because a Google search that gets tracked and compared. Businesses can also pay to appear higher in advertised search rankings.

    TL;DR: You are given free access to improve Google’s data and they sell off that improved data to companies, or charge for higher visibility to their potential customers.


  • I still code with the mindset of “I need my software to be good or my clients will leave.”

    Google no longer operates like this. None of what you listed has any financial benefit to Google. You’re not going anywhere. All they stand to do is make more money off of you. If they can simplify the software, from being handcrafted by humans perfectly for you, to, instead, generated by an unsalaried AI, they’ll do that. They stand to lose mostly nothing and gain by reducing their workforce.

    The competition for quality doesn’t exist because the money they save by moving to AI is apparent across the industry. Everyone is looking to use it meaning the only competition is who can provide better cheap AI, not who can make a better product for their users.







  • NU7400 has a peak of 337 nits and that’s with the poorer contrast ratio of LCD. My LG C1 is 780 nits. I still find it a bit weak with the lights on so I can’t imagine 330 on LCD.

    Yeah, HDR is meant to be watched in a 5-nit environment, but sometimes that’s just not reasonable. While my LG is technically better, bright TV shows like Rings of Power are more enjoyable with the 1500 nits my TCL can output. Once that ABL (Automatic Brightness Limiter) kicks in for the OLED, you absolutely need the blackout curtains.