paseto4j icon indicating copy to clipboard operation
paseto4j copied to clipboard

Use javax.security.PrivateKey and PublicKey as argument to the PrivateKey and PublicKey class wrappers

Open nbaars opened this issue 3 years ago • 6 comments

At the moment the moment both classes take a byte[] as argument:

 public PublicKey(byte[] keyMaterial, Version version) {
        super(keyMaterial, version);
    }

It is easier from a user perspective to change this to:

 public PublicKey(javax.security.PublicKey, Version version) {
        super(keyMaterial, version);
    }

this way the API is not responsible for translations, we take a valid key which the user needs to obtain from a byte[], PEM encoded string etc.

nbaars avatar Aug 06 '22 08:08 nbaars

Hi, is this issue still open?

JonathanXu8 avatar Sep 24 '23 22:09 JonathanXu8

@JonathanXu8 yes, this issue is still open. Let me know if you like to pick it up.

nbaars avatar Sep 25 '23 19:09 nbaars

Sounds good! I'd like to pick it up.

JonathanXu8 avatar Sep 26 '23 00:09 JonathanXu8

Hi @nbaars, just like to confirm the requirements. It seems that V3 already supports public PublicKey(javax.security.PublicKey, Version version). So all I have to do is to implement the same thing for v1 and v2. Right?

JonathanXu8 avatar Oct 05 '23 01:10 JonathanXu8

Hi @JonathanXu8 indeed only necessary for V1 and V2

nbaars avatar Oct 11 '23 07:10 nbaars