Exemplo n.º 1
0
 static OpenSSLKey getInstance(RSAPublicKey rsaPublicKey) throws InvalidKeyException {
   try {
     return new OpenSSLKey(
         NativeCrypto.EVP_PKEY_new_RSA(
             rsaPublicKey.getModulus().toByteArray(),
             rsaPublicKey.getPublicExponent().toByteArray(),
             null,
             null,
             null,
             null,
             null,
             null));
   } catch (Exception e) {
     throw new InvalidKeyException(e);
   }
 }
Exemplo n.º 2
0
  private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    key =
        new OpenSSLKey(
            NativeCrypto.EVP_PKEY_new_RSA(
                modulus.toByteArray(),
                publicExponent.toByteArray(),
                null,
                null,
                null,
                null,
                null,
                null));
    fetchedParams = true;
  }
Exemplo n.º 3
0
 OpenSSLRSAPublicKey(RSAPublicKeySpec spec) throws InvalidKeySpecException {
   try {
     key =
         new OpenSSLKey(
             NativeCrypto.EVP_PKEY_new_RSA(
                 spec.getModulus().toByteArray(),
                 spec.getPublicExponent().toByteArray(),
                 null,
                 null,
                 null,
                 null,
                 null,
                 null));
   } catch (Exception e) {
     throw new InvalidKeySpecException(e);
   }
 }