Java 8 RSAPublicKeySpec - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 RSAPublicKeySpec class.

This code example shows how to use the following methods:getModulus, getPublicExponent
import org.bouncycastle.asn1.ASN1Sequence; 
import org.bouncycastle.asn1.DERObjectIdentifier; 
import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 
import org.bouncycastle.asn1.pkcs.RSAPrivateKeyStructure; 
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 
import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; 
// BEGIN android-removed 
// import org.bouncycastle.jce.interfaces.ElGamalPrivateKey; 
// import org.bouncycastle.jce.interfaces.ElGamalPublicKey; 
// import org.bouncycastle.jce.spec.ElGamalPrivateKeySpec; 
// import org.bouncycastle.jce.spec.ElGamalPublicKeySpec; 
// import org.bouncycastle.jce.spec.GOST3410PrivateKeySpec; 
// import org.bouncycastle.jce.spec.GOST3410PublicKeySpec; 
// END android-removed 
 
public abstract class JDKKeyFactory 
    extends KeyFactorySpi
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:getModulus, getPublicExponent
 
   /** 
    * @return true if the keypairs match 
    */ 
   public static boolean privateKeyMatchesPublicKey(RSAPrivateCrtKeySpec privateKey, RSAPublicKeySpec publicKey) {
      return privateKey.getPublicExponent().equals(publicKey.getPublicExponent())
               && privateKey.getModulus().equals(publicKey.getModulus());
   } 
 
   /** 
    * @return true if the keypair has the same fingerprint as supplied 
    */ 
   public static boolean privateKeyHasFingerprint(RSAPrivateCrtKeySpec privateKey, String fingerprint) {
      return fingerprint(privateKey.getPublicExponent(), privateKey.getModulus()).equals(fingerprint);
   } 
 
   /** 
    * @param privateKeyPEM 
    *           RSA private key in PEM format 
    * @param fingerprint 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getModulus, getPublicExponent
    } 
 
    JCERSAPublicKey( 
        RSAPublicKeySpec spec)
    { 
        this.modulus = spec.getModulus();
        this.publicExponent = spec.getPublicExponent();
    } 
 
    JCERSAPublicKey( 
        RSAPublicKey key)
    { 
        this.modulus = key.getModulus();
        this.publicExponent = key.getPublicExponent();
    } 
 
    JCERSAPublicKey( 
        SubjectPublicKeyInfo    info)
    { 
        try 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getModulus, getPublicExponent
This code example shows how to use the following methods:
	int exponentLength = readInt(keyByteArray, modulusLength + 4);
	byte[] exponentByteArray = new byte[exponentLength];
	System.arraycopy(keyByteArray, modulusLength + 8, exponentByteArray, 0, exponentLength);
	BigInteger publicExponent = new BigInteger(1, exponentByteArray);
 
	return KeyFactory.getInstance("RSA").generatePublic(new RSAPublicKeySpec(modulus, publicExponent));
    } 
 
    /** 
     * Encrypts given string with Google Public Key. 
     *  
     */ 
    public static String encryptString(String str2Encrypt) throws Exception {
 
	byte[] keyByteArray = Base64.decode(GOOGLE_PUBLIC_KEY, Base64.DEFAULT);
 
	byte[] header = new byte[5];
	byte[] digest = MessageDigest.getInstance("SHA-1").digest(keyByteArray);
	header[0] = 0;
	System.arraycopy(digest, 0, header, 1, 4);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getModulus, getPublicExponent
 
    BCRSAPublicKey( 
        RSAPublicKeySpec spec)
    { 
        this.algorithmIdentifier = DEFAULT_ALGORITHM_IDENTIFIER;
        this.modulus = spec.getModulus();
        this.publicExponent = spec.getPublicExponent();
    } 
 
    BCRSAPublicKey( 
        RSAPublicKey key)
    { 
        this.algorithmIdentifier = DEFAULT_ALGORITHM_IDENTIFIER;
        this.modulus = key.getModulus();
        this.publicExponent = key.getPublicExponent();
    } 
 
    BCRSAPublicKey( 
        SubjectPublicKeyInfo info)
    { 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getModulus, getPublicExponent
    } 
 
    JCERSAPublicKey( 
        RSAPublicKeySpec spec)
    { 
        this.modulus = spec.getModulus();
        this.publicExponent = spec.getPublicExponent();
    } 
 
    JCERSAPublicKey( 
        RSAPublicKey key)
    { 
        this.modulus = key.getModulus();
        this.publicExponent = key.getPublicExponent();
    } 
 
    JCERSAPublicKey( 
        SubjectPublicKeyInfo    info)
    { 
        try 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getPublicExponent
     * Test for <code>getPublicExponent()</code> method<br> 
     * Assertion: returns public exponent 
     */ 
    public final void testGetPublicExponent() { 
        RSAPublicKeySpec rpks =
            new RSAPublicKeySpec(BigInteger.valueOf(3L),
                                 BigInteger.valueOf(1234567890L));
        assertTrue(BigInteger.valueOf(1234567890L).equals(rpks.getPublicExponent()));
    } 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getPublicExponent
     * Test for <code>getPublicExponent()</code> method<br> 
     * Assertion: returns public exponent 
     */ 
    public final void testGetPublicExponent() { 
        RSAPublicKeySpec rpks =
            new RSAPublicKeySpec(BigInteger.valueOf(3L),
                                 BigInteger.valueOf(1234567890L));
        assertTrue(BigInteger.valueOf(1234567890L).equals(rpks.getPublicExponent()));
    } 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 RSAPublicKeySpec Questions & Answers:

See Code Examples for Java 8 RSAPublicKeySpec Methods: