Exemplo n.º 1
0
 /**
  * Static method to convert Key into an instance of RSAPublicKeyImpl or RSAPrivate(Crt)KeyImpl. If
  * the key is not an RSA key or cannot be used, throw an InvalidKeyException.
  *
  * <p>Used by RSASignature and RSACipher.
  */
 public static RSAKey toRSAKey(Key key) throws InvalidKeyException {
   if ((key instanceof RSAPrivateKeyImpl)
       || (key instanceof RSAPrivateCrtKeyImpl)
       || (key instanceof RSAPublicKeyImpl)) {
     return (RSAKey) key;
   } else {
     return (RSAKey) INSTANCE.engineTranslateKey(key);
   }
 }