Skip to content

Commit

Permalink
fixed code smell
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeplotean committed Apr 8, 2022
1 parent 0c3cad4 commit f36f552
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.nimbusds.jose.jwk.JWK
import id.walt.crypto.*
import id.walt.services.CryptoProvider
import id.walt.services.keystore.KeyStoreService
import mu.KotlinLogging
import org.bouncycastle.asn1.ASN1ObjectIdentifier
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo
Expand All @@ -18,6 +19,8 @@ import java.security.PublicKey
import java.security.spec.PKCS8EncodedKeySpec
import java.security.spec.X509EncodedKeySpec

private val log = KotlinLogging.logger {}

interface KeyImportStrategy {
fun import(keyStore: KeyStoreService): KeyId
}
Expand Down Expand Up @@ -54,7 +57,8 @@ class PEMImportImpl(val keyString: String) : KeyImportStrategy {
pemObj = parser.readObject()
pemObj?.run { pemObjs.add(this) }
} while (pemObj != null)
} catch (_: Exception) {
} catch (e: Exception) {
log.debug { "Importing key ${e.message}" }
}
val kid = newKeyId()
val keyPair = getKeyPair(*pemObjs.map { it }.toTypedArray())
Expand Down

0 comments on commit f36f552

Please sign in to comment.