private String toJsonString ( ) { Map < String , String > map = new HashMap < String , String > ( ) ; byte [ ] encryptedCEK = getEncryptedCEK ( ) ; map . put ( Headers . CRYPTO_KEY_V2 , Base64 . encodeAsString ( encryptedCEK ) ) ; byte [ ] iv = cipherLite . getIV ( ) ; map . put ( Headers . CRYPTO_IV , Base64 . encodeAsString ( iv ) ) ; map . put ( Headers . MATERIALS_DESCRIPTION , kekMaterialDescAsJson ( ) ) ; // The CRYPTO_CEK_ALGORITHM, CRYPTO_TAG_LENGTH and // CRYPTO_KEYWRAP_ALGORITHM were not available in the Encryption Only // (EO) implementation ContentCryptoScheme scheme = getContentCryptoScheme ( ) ; map . put ( Headers . CRYPTO_CEK_ALGORITHM , scheme . getCipherAlgorithm ( ) ) ; int tagLen = scheme . getTagLengthInBits ( ) ; if ( tagLen > 0 ) map . put ( Headers . CRYPTO_TAG_LENGTH , String . valueOf ( tagLen ) ) ; String keyWrapAlgo = getKeyWrappingAlgorithm ( ) ; if ( keyWrapAlgo != null ) map . put ( Headers . CRYPTO_KEYWRAP_ALGORITHM , keyWrapAlgo ) ; return Jackson . toJsonString ( map ) ; }
Returns the json string in the latest format .