CardEncryption

class CardEncryption(type: CardEncryption.CardType, publicKeyString: String, uid: String?)

Class used to encrypt Visa, MasterCard, and Amex cards for enrollment into the Thanx loyalty platform.

Constructors

CardEncryption
Link copied to clipboard
fun CardEncryption(type: CardEncryption.CardType, publicKeyString: String, uid: String? = null)
Creates a new CardEncryption object to handle the card number encryption.

Types

CardType
Link copied to clipboard
enum CardType : Enum<CardEncryption.CardType>
Type of card
EncryptionError
Link copied to clipboard
abstract class EncryptionError(message: String) : Exception
Exception raised when the encryption fails at any point.
InvalidAESEncryption
Link copied to clipboard
class InvalidAESEncryption(message: String) : CardEncryption.EncryptionError
Error when trying to encrypt with the AES algorithm.
InvalidPublicKey
Link copied to clipboard
class InvalidPublicKey(message: String) : CardEncryption.EncryptionError
Error during PEM public string parsing.
InvalidRSAEncryption
Link copied to clipboard
class InvalidRSAEncryption(message: String) : CardEncryption.EncryptionError
Error when trying to encrypt with the RSA algorithm.
RequiredUid
Link copied to clipboard
class RequiredUid(message: String) : CardEncryption.EncryptionError
Error when the uid is required for encryption.

Functions

encrypt
Link copied to clipboard
fun encrypt(number: String): String
Encrypts the card number.
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
toString
Link copied to clipboard
open fun toString(): String