Closed ngallazzi closed 1 month ago
Hey! Yeah, sorry about that, but RFC 5915 PEM/DER encoding is not yet supported. (It looks like I need to start writing some documentation...)
Current PEM/DER encoding is based on PKCS8 / RFC 5208. The main problem with RFC 5915 is that it's not widely supported in providers: nor WebCrypto, nor JDK, nor Apple providers support it out of the box. TBH, I've tried to support it before but decided to postpone it. Now we do have all primitives which are needed to implement it (like ASN.1 module) and will try my best to make RFC 5915 compatible encoding available in the next release.
@whyoleg thanks for the quick answer, I see!
If you use 0.4.0 snapshot then you can switch it to EC.PrivateKey.Format.PEM.SEC1
and rfc 5915 will work!
@ColtonIdle thanks for the reply! However seems that the last snapshot is missing on sonatype.
My config:
repositories {
mavenCentral()
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
google()
}
androidMain.dependencies {
implementation("dev.whyoleg.cryptography:cryptography-provider-jdk:0.4.0-SNAPSHOT")
}
commonMain.dependencies {
implementation("dev.whyoleg.cryptography:cryptography-core:0.4.0-SNAPSHOT")
}
iosMain.dependencies {
implementation("dev.whyoleg.cryptography:cryptography-provider-apple:0.4.0-SNAPSHOT")
}
0.4.0 was just released!
EC.PrivateKey.Format.PEM.SEC1
can be used now
I'm trying to generate ECDSA signature from a known private key generated according to RFC 5915 specifications. However when I try to decode the key I get a parsing exception:
Wrong PEM label, expected PemLabel(representation=PRIVATE KEY), actual PemLabel(representation=EC PRIVATE KEY)
Isn't the library supposed to work with the RFC 5915 private key format? Thanks for the support?