bc-java
bc-java copied to clipboard
hwo to parse sm2 certificate and create class PrivateKey
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)
My real request is to use sm4 encrypt the sm2 Privatekey to create encrypted Privatekey