Examples of Certificate


Examples of net.rim.device.api.crypto.certificate.Certificate

                    new CryptoSmartCardKeyStoreData[3];

            // For this sample we use a hard coded certificate contained below.
            // This encoding would be extracted from the card using a series of
            // APDU commands.
            Certificate certificate = null;
            try {
                certificate = new X509Certificate(CERTIFICATE_ENCODING);
            } catch (final CertificateParsingException e) {
                // Should not happen.
            }
View Full Code Here

Examples of org.apache.clerezza.ssl.keygen.Certificate

                // a webid is not a good idea, but this will at least be something.
                if (webId != null && webId.length() > 0) cn = webId;
                else cn = "default name (please improve keygen UI code)";
            }

            Certificate cert;
            if ((spkacData == null) || spkacData.isEmpty()) {
                cert = keygen.createFromSpkac(spkacData);

            } else {
                cert = keygen.createFromPEM(pemCsrData);
            }
            cert.setSubjectCommonName(cn);
            cert.addSubjectAlternativeName(webId);
            cert.addDurationInDays("365");
            cert.startEarlier("1"); //always start one hour earlier at least, to avoid clock synchronisation issues
            cert.getSerialisation().writeTo(response);
        } catch (Exception e) {
           throw new ServletException("could not create certificate",e);
        }
    }
View Full Code Here

Examples of org.apache.harmony.security.x509.Certificate

            signatureValue[20]++;
        } else {
            signatureValue = signatureValueBytes;
        }
       
        Certificate cert =
            new Certificate(tbsCertificate, signature, signatureValue);

        certEncoding = cert.getEncoded();

        cert = (Certificate) Certificate.ASN1.decode(certEncoding);
        certificate = new X509CertImpl(cert);
    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Certificate

      AsymmetricKeyParameter caPrivateKeyParameters = PrivateKeyFactory.createKey(signerPrivateKey.getEncoded());
      ContentSigner contentSigner = new BcRSAContentSignerBuilder(sigAlgId, digestAlgId)
          .build(caPrivateKeyParameters);

      X509CertificateHolder certificateHolder = certificateBuilder.build(contentSigner);
      Certificate certificate = certificateHolder.toASN1Structure();

      return certificate;
    } catch (OperatorCreationException e) {
      throw new OpsException("Error signing certificate", e);
    } catch (IOException e) {
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Certificate

  }

  public X509Certificate signCsr(PKCS10CertificationRequest csr) throws OpsException {
    SubjectPublicKeyInfo subjectPublicKeyInfo = csr.getSubjectPublicKeyInfo();
    X500Name subject = csr.getSubject();
    Certificate certificate = signCertificate(
        BouncyCastleHelpers.toX500Name(caCertificate[0].getSubjectX500Principal()), caPrivateKey, subject,
        subjectPublicKeyInfo);
    return toX509(certificate);
  }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Certificate

  // }
  // }

  public static X509Certificate signAsCa(X500Principal subject, PublicKey subjectPublicKey, X500Principal issuer,
      PrivateKey issuerPrivateKey) throws OpsException {
    Certificate certificate = signCertificate(BouncyCastleHelpers.toX500Name(issuer), issuerPrivateKey,
        BouncyCastleHelpers.toX500Name(subject), BouncyCastleHelpers.toSubjectPublicKeyInfo(subjectPublicKey));
    return toX509(certificate);
  }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Certificate

    return toX509(certificate);
  }

  public static X509Certificate selfSign(X500Principal subject, KeyPair keyPair) throws OpsException {
    X500Principal issuer = subject;
    Certificate certificate = signCertificate(BouncyCastleHelpers.toX500Name(issuer), keyPair.getPrivate(),
        BouncyCastleHelpers.toX500Name(subject),
        BouncyCastleHelpers.toSubjectPublicKeyInfo(keyPair.getPublic()));
    return toX509(certificate);
  }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Certificate

      // Self sign
      X500Name issuer = subject;
      PrivateKey issuerPrivateKey = keyPair.getPrivate();

      Certificate certificate = signCertificate(issuer, issuerPrivateKey, subject, subjectPublicKeyInfo);
      return toX509(certificate);
    } catch (IOException e) {
      throw new OpsException("Error reading CSR", e);
    }
  }
View Full Code Here

Examples of org.ejbca.core.protocol.ws.client.gen.Certificate

        assertTrue(responses.size() == 2);

        Iterator<TokenCertificateResponseWS> iter = responses.iterator();
        TokenCertificateResponseWS next = iter.next();
        assertTrue(next.getType() == HardTokenConstants.RESPONSETYPE_CERTIFICATE_RESPONSE);
        Certificate cert = next.getCertificate();
        X509Certificate realcert = (X509Certificate) CertificateHelper.getCertificate(cert.getCertificateData());
        assertNotNull(realcert);
        assertTrue(realcert.getNotAfter().toString(), realcert.getNotAfter().before(new Date(System.currentTimeMillis() + 2 * 24 * 3600 * 1000)));
        next = iter.next();
        assertTrue(next.getType() == HardTokenConstants.RESPONSETYPE_KEYSTORE_RESPONSE);
        KeyStore keyStore = next.getKeyStore();
View Full Code Here

Examples of org.ejbca.core.protocol.ws.objects.Certificate

      retval.setCreateTime(dateToXMKGregorianCalendar(data.getCreateTime()));
      retval.setEncKeyKeyRecoverable(false);

      Iterator<java.security.cert.Certificate> iter = certificates.iterator();
      while(iter.hasNext()){
        retval.getCertificates().add(new Certificate(iter.next()));
      }
    }catch(DatatypeConfigurationException e){
      log.error("EJBCA WebService error, getHardToken: ",e);
      throw new EjbcaException(ErrorCode.INTERNAL_ERROR, e.getMessage());
    }catch(CertificateEncodingException e){
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.