bcgit / pc-dart

Pointy Castle - Dart Derived Bouncy Castle APIs
MIT License
237 stars 122 forks source link

How to implement OAEP| SHA3-256 #86

Open zhoulijun12315 opened 3 years ago

zhoulijun12315 commented 3 years ago

we have the java code, like:

public static String rsaEncryptWithPublicKey(String s, java.security.PublicKey pub) throws GeneralSecurityException, UnsupportedEncodingException {
        javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("RSA", "BC");
        cipher.init(Cipher.ENCRYPT_MODE, pub, new javax.crypto.spec.OAEPParameterSpec("SHA3-256", "MGF1", MGF1ParameterSpec.SHA256, PP));
        return bytesToString(cipher.doFinal(s.getBytes(StandardCharsets.UTF_8)));
}

but, i don't know how to translated into dart

AKushWarrior commented 3 years ago

We have not implemented that algorithm. This is not a perfect port of BouncyCastle.

These compositions are tricky. I can look into adding it, but there's no guarantee of the timetable.