JsDoc Reference - PaperKeyEncoding

Class Index | File Index

## Classes

- _global_
- AccessController
- APDU
- AuthenticationObject
- CAConnection
- ChipAuthentication
- ChipAuthenticationDomainParameterInfo
- ChipAuthenticationInfo
- ChipAuthenticationPublicKeyInfo
- CommandInterpreter
- CRLGenerator
- CVC
- CVCCA
- CVCertificateStore
- DataUnitAPDU
- DF
- DKEK
- DNEncoder
- EAC20
- EAC2CVCertificateGenerator
- EAC2CVRequestGenerator
- FCP
- File
- FileEncryptor
- FileSelector
- FileSystemIdObject
- FSNode
- GPSCP03
- HSMCVCertificateStore
- HSMKeyStore
- LinearEF
- ManagePKA
- P11CVCertificateStore
- PACE
- PACEDomainParameterInfo
- PACEInfo
- PaperKeyEncoding
- PKCS10Generator
- PublicKeyFile
- PublicKeyReference
- RAMClient
- RestrictedIdentificationDomainParameterInfo
- RestrictedIdentificationInfo
- SecureChannelHandler
- SecureMessagingCommandAPDUDecoder
- SecurityEnvironment
- SignatureKey
- SmartCardHSM
- SmartCardHSMCrypto
- SmartCardHSMInitializer
- SmartCardHSMKey
- SmartCardHSMKeySpecGenerator
- SmartCardHSMSymmetricKeySpecGenerator
- TransparentEF
- TrustAnchor
- X509CertificateGenerator
- X509CertificateIssuer
- X509CertificateStore
- X509Signer

# Class PaperKeyEncoding

Encoder / Decoder for PaperKeys
Defined in: PaperKeyEncoding.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| PaperKeyEncoding() Create a PaperKey encoder/decoder

Method Summary
Method Attributes | Method Name and Description
--- | ---
| decodeSegment(segment, str) Decode an 8 byte segment from 12 input characters.
<static> | PaperKeyEncoding.dumpKey(data) Dump a key
| encodeSegment(segment, data) Encode an 8 byte segment in human readable form.
<static> | PaperKeyEncoding.formatSegment(str) Format a segment by splitting the input after each 4 characters and inserting " - "

Class Detail
PaperKeyEncoding()
Create a PaperKey encoder/decoder
Method Detail
{ByteString} decodeSegment(segment, str)
Decode an 8 byte segment from 12 input characters. Characters not in the alphabet are ignored. Throws GPError with GPError.INVALID_LENGTH if the input does not contain at least 12 usable characters. Throws GPError with GPError.SIGNATURE_FAILED if the check digit based validation fails. Throws GPError with GPError.INVALID_DATA if the segment number does not match the expected value.

Parameters:
{Number} segment
{String} str
  the user input

Returns:
  the 8 byte segment

<static> {String} PaperKeyEncoding.dumpKey(data)
Dump a key

Parameters:
{ByteString} data
  the key value (length must be a multiple of 8)

Returns:
  the formatted key with 3 groups of 4 digits per line

{String} encodeSegment(segment, data)
Encode an 8 byte segment in human readable form. Based on BASE64 encoding with visually confusable characters replaced. I is replaced by ! O is replaced by * l is replaced by % A LUHN-64 character is appended. A segment identifier is encoded in 2 bit at the end of the encoded 64 bit string.

Parameters:
{Number} segment
{ByteString} data

Returns:
  the encoded string

<static> {String} PaperKeyEncoding.formatSegment(str)
Format a segment by splitting the input after each 4 characters and inserting " - "

Parameters:
{String} str
  the unformatted string

Returns:
  the formatted string

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Mar 18 2026 21:29:18 GMT+0100 (CET)