1818import org .openapitools .jackson .nullable .JsonNullableModule ;
1919
2020import java .net .URI ;
21+ import java .nio .charset .StandardCharsets ;
2122import java .security .NoSuchAlgorithmException ;
2223import java .security .spec .InvalidKeySpecException ;
2324import java .text .ParseException ;
2930import java .util .UUID ;
3031import java .util .stream .Collectors ;
3132
32- import static cloud .katta .crypto .KeyHelper .decodePrivateKey ;
33-
3433import cloud .katta .crypto .exceptions .NotECKeyException ;
3534import cloud .katta .model .JWEPayload ;
3635import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
5150import com .nimbusds .jose .jwk .JWKSet ;
5251import com .nimbusds .jose .jwk .OctetSequenceKey ;
5352import com .nimbusds .jose .jwk .gen .OctetSequenceKeyGenerator ;
54- import com .nimbusds .jose .util .Base64URL ;
53+
54+ import static cloud .katta .crypto .KeyHelper .decodePrivateKey ;
5555
5656/**
5757 * Represents payload of <a href="https://github.com/encryption-alliance/unified-vault-format/blob/develop/vault%20metadata/README.md"><code>vault.uvf</code> metadata</a>.
@@ -101,7 +101,7 @@ public String toJSON() throws JsonProcessingException {
101101 }
102102
103103 public static UvfMetadataPayload create () {
104- final String kid = Base64URL . encode ( new AlphanumericRandomStringService (4 ).random ()). toString ( );
104+ final String kid = Base64 . getUrlEncoder (). encodeToString ( new AlphanumericRandomStringService (4 ).random (). getBytes ( StandardCharsets . UTF_8 ) );
105105 final byte [] rawSeed = new byte [32 ];
106106 FastSecureRandomProvider .get ().provide ().nextBytes (rawSeed );
107107 final byte [] kdfSalt = new byte [32 ];
@@ -110,12 +110,12 @@ public static UvfMetadataPayload create() {
110110 .withFileFormat ("AES-256-GCM-32k" )
111111 .withNameFormat ("AES-SIV-512-B64URL" )
112112 .withSeeds (new HashMap <String , String >() {{
113- put (kid , Base64 .getEncoder ().encodeToString (rawSeed ));
113+ put (kid , Base64 .getUrlEncoder ().encodeToString (rawSeed ));
114114 }})
115115 .withLatestSeed (kid )
116116 .withinitialSeed (kid )
117117 .withKdf ("HKDF-SHA512" )
118- .withKdfSalt (Base64 .getEncoder ().encodeToString (kdfSalt ));
118+ .withKdfSalt (Base64 .getUrlEncoder ().encodeToString (kdfSalt ));
119119 }
120120
121121 public String computeRootDirIdHash () throws JsonProcessingException {
0 commit comments