Encryption with private key? we normally always encrypt by public key and decrypt with private key.


If i encrypt with private key, then its still secure as normal PKI ?
i mean known-plain-text will not take private key on the risk ? (for example when people know the plain text and signed message with private key, then private key is safe or will compromise?
When we encrypt with the public key then known-plain-text make public key compromise but private key is safe?
Well, first of all, this is not a generic 'public-key' question.  With RSA, it can make sense to talk about 'encrypting with the private key', for most other public key algorithms, there's isn't an obvious interpretation.  For example, with DSA, the public key operation (which is a signature verification) is 'plug the data from the signature, the hash of the data and the public key into a formula; the signature passes of both sides are the same value'.  There's no obvious way to use this type of operation to encrypt something.

Now, in your question, you ask whether encrypting with the RSA private key is secure.  Well, that depends on what you mean by secure; what precisely are you attempting preventing someone from doing?  In one sense, it is not secure at all; anyone who has the public key can decrypt the message.  Since it is generally true that anyone can get the public key, well, this means that this is not at all a secure encryption method.

On the other hand, you might not be assuming that this is a secure encryption method; this might be an attempt to simulate RSA signature generation.  Here, you have to be careful; RSA using padding methods to translate between the message being encrypted/signed into a value to give to the raw RSA function.  The security properties for an encryption padding method are different from the security properties for a signature padding method; in fact, there are real world secure encryption padding methods (for example, RSAES-PKCS1-v1_5 with e=3) that could be insecure if used as a signature padding method.

However, you may simply be asking "would the key be secure"?  In some sense, that is irrelevant; usually, the only reason an attacker wants the keys is that would allow him to perform some operation; if he can perform those operations without the keys (because, for example, of the vulnerabilities mentioned in the above two paragraphs), then he doesn't need the keys.  However, if you are still concerned about the keying data, well, it turns out that RSA is safe; performing RSA operations (even on attacker chosen values) doesn't leak the private key.