Generating subject public key info in a compressed form

Certificate

That is usefull for NFC encryption key used by terminals that support apple VAS


openssl ec -in private_key.pem -pubout -out compressed_public_key.pem -conv_form compressed

Then, when using passbook generator from here: https://github.com/tomasmcguinness/dotnet-passbook pass that key to the NFC constructor:


request.Nfc = new Nfc("15407F6", @"MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgAC/O3/C07TB7WkJuUZ1vZkAn4LZs+IGUpy7BMnh1bKrBY=");

Doing the same with bouncycastle c#:


PemReader pemReaderPrivate = new PemReader(new StringReader(...));
ECPublicKeyParameters ecPublicParameters = (ECPublicKeyParameters)pemReaderPrivate.ReadObject();
byte[] compressed = ecPublicParameters.Q.GetEncoded(true);
byte[] uncompressed = ecPublicParameters.Q.GetEncoded(false);

Post a Comment

Previous Post Next Post