Examples of PublicKey


Examples of com.jcabi.github.PublicKey

     * @throws Exception If a problem occurs.
     */
    @Test
    public void canBePatched() throws Exception {
        final String original = "PublicKey2";
        final PublicKey key = new MkGithub().users().get("jeff")
            .keys().create("Title2", original);
        final String patched = String.format("%s_patch", original);
        key.patch(
            Json.createObjectBuilder().add(KEY, patched).build()
        );
        MatcherAssert.assertThat(
            key.json().getString(KEY),
            Matchers.equalTo(patched)
        );
    }
View Full Code Here

Examples of com.keybox.manage.model.PublicKey

            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement(sql);
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {
                PublicKey publicKey = new PublicKey();
                publicKey.setId(rs.getLong("id"));
                publicKey.setKeyNm(rs.getString("key_nm"));
                publicKey.setPublicKey(rs.getString("public_key"));
                publicKey.setProfile(ProfileDB.getProfile(con, rs.getLong("profile_id")));
                publicKeysList.add(publicKey);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);
View Full Code Here

Examples of com.maverick.crypto.publickey.PublicKey

        try {

            // Encrypt the premaster secret
            BigInteger input = new BigInteger(1, premasterSecret);

            PublicKey key = x509.getPublicKey();

            if (key instanceof RsaPublicKey) {

                BigInteger padded = Rsa.padPKCS1(input, 0x02, 128);
                BigInteger s = Rsa.doPublic(padded, ((RsaPublicKey) key).getModulus(), ((RsaPublicKey) key).getPublicExponent());
View Full Code Here

Examples of com.maverick.crypto.publickey.PublicKey

                X509Certificate trusted = (X509Certificate) CertificateStore.getInstance().get(x509.getIssuerDN().toString());

                // Verify the signature of the certificate with the trusted
                // certificate
                PublicKey publickey = trusted.getPublicKey();

                if (publickey instanceof RsaPublicKey) {
                    // Verify the signature
                    if (x509.getSigAlgName().equals("MD5WithRSAEncryption")) { //$NON-NLS-1$
View Full Code Here

Examples of java.security.PublicKey

      }
      return true;
    }

    // Get public key
    PublicKey publickey = getPublicKey();

    return validate(publickey, identity);
  }
View Full Code Here

Examples of java.security.PublicKey

      KeyPairGenerator keyGen = KeyPairGenerator.getInstance(ALGORITHM);
      keyGen.initialize(DH_SPEC);
      KeyPair keypair = keyGen.generateKeyPair();

      privateKey = keypair.getPrivate();
      PublicKey publicKey = keypair.getPublic();

      return publicKey.getEncoded();
    } catch (NoSuchAlgorithmException e) {
      throw new CryptoException(e);
    } catch (InvalidAlgorithmParameterException e) {
      throw new CryptoException(e);
    }
View Full Code Here

Examples of java.security.PublicKey

    }
    try {
      X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(
          peerPublicKeyBytes);
      KeyFactory keyFact = KeyFactory.getInstance(ALGORITHM);
      PublicKey publicKey = keyFact.generatePublic(x509KeySpec);

      KeyAgreement ka = KeyAgreement.getInstance(ALGORITHM);
      ka.init(privateKey);
      ka.doPhase(publicKey, true);
      byte[] secret = ka.generateSecret();
View Full Code Here

Examples of java.security.PublicKey

    try{     
          BigInteger  other_dh_y = bytesToBigInteger( buffer, 0, DH_SIZE_BYTES );
         
          KeyFactory dh_key_factory = KeyFactory.getInstance("DH");
               
        PublicKey other_public_key = dh_key_factory.generatePublic( new DHPublicKeySpec( other_dh_y, DH_P_BI, DH_G_BI ));
             
        key_agreement.doPhase( other_public_key, true );
       
        secret_bytes = key_agreement.generateSecret();
         
View Full Code Here

Examples of java.security.PublicKey

    byte[]    data,
    byte[]    signature )
 
    throws CryptoManagerException
  {
    PublicKey  pub = CryptoECCUtils.rawdataToPubkey( public_key );
   
    Signature sig = CryptoECCUtils.getSignature( pub );
   
    try{
      sig.update( data );
View Full Code Here

Examples of java.security.PublicKey

    * @throws KeyResolverException
    */

   public PublicKey getPublicKey() throws KeyResolverException {

      PublicKey pk = this.getPublicKeyFromInternalResolvers();

      if (pk != null) {
         if (log.isLoggable(java.util.logging.Level.FINE))                                     log.log(java.util.logging.Level.FINE, "I could find a key using the per-KeyInfo key resolvers");

         return pk;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.