create

@JvmStatic
@JvmOverloads
fun <P : ApiKey.Property> create(privateKey: ByteArray, clear: Boolean, keyId: String, properties: Set<P>, daysUntilExpiry: Int, extras: Set<String> = emptySet()): ApiKey<P>(source)

Creates a new ApiKey for the provided arguments.

Parameters

privateKey

the raw, unencrypted PKCS#1 or PKCS#8 encoded RSAKey.Private bytes

clear

if true, privateKey bytes will be zeroed out

Throws

GeneralSecurityException

if privateKey is invalid

InvalidKeyException

if privateKey is invalid

InvalidParameterException

when:

  • keyId is blank

  • keyId contains whitespace

  • keyId contains multiple lines

  • keyId contains invalid UTF-8 characters or sequences

  • daysUntilExpiry is less than or equal to 0

  • extras contains a blank value

  • extras contains a value with multiple lines

  • extras contains a value with invalid UTF-8 characters or sequences