bc-java icon indicating copy to clipboard operation
bc-java copied to clipboard

hwo to parse sm2 certificate and create class PrivateKey

Open flymoondust opened this issue 2 years ago • 1 comments

I use this:PrivateKeyInfo privateKeyInfo = PrivateKeyInfo.getInstance(bytesContents);

exception:

java.lang.IllegalArgumentException: failed to construct sequence from byte[]: Extra data detected in stream

	at org.bouncycastle.asn1.ASN1Sequence.getInstance(Unknown Source)
	at org.bouncycastle.asn1.pkcs.PrivateKeyInfo.getInstance(Unknown Source)

flymoondust avatar Jul 18 '23 03:07 flymoondust

My real request is to use sm4 encrypt the sm2 Privatekey to create encrypted Privatekey

flymoondust avatar Jul 18 '23 04:07 flymoondust