Java 8 CertificateEncodingException - 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 CertificateEncodingException class.

This code example shows how to use the following methods:getMessage
        { 
            return Certificate.getInstance(certificate.getEncoded());
        } 
        catch (CertificateEncodingException e)
        { 
            throw new PKCSIOException("cannot encode certificate: " + e.getMessage(), e);
        } 
    } 
 
    public JcaPKCS12SafeBagBuilder(PrivateKey privateKey, OutputEncryptor encryptor)
    { 
        super(PrivateKeyInfo.getInstance(privateKey.getEncoded()), encryptor);
    } 
 
    public JcaPKCS12SafeBagBuilder(PrivateKey privateKey)
    { 
        super(PrivateKeyInfo.getInstance(privateKey.getEncoded()));
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCause, getMessage
     * Test for <code>CertificateEncodingException(Throwable)</code> 
     * constructor Assertion: constructs CertificateEncodingException when 
     * <code>cause</code> is not null 
     */ 
    public void testCertificateEncodingException05() { 
        CertificateEncodingException tE = new CertificateEncodingException(
                tCause);
        if (tE.getMessage() != null) {
            String toS = tCause.toString();
            String getM = tE.getMessage();
            assertTrue("getMessage() should contain ".concat(toS), (getM
                    .indexOf(toS) != -1));
        } 
        assertNotNull("getCause() must not return null", tE.getCause());
        assertEquals("getCause() must return ".concat(tCause.toString()), tE
                .getCause(), tCause);
    } 
 
    /** 
     * Test for <code>CertificateEncodingException(String, Throwable)</code> 
     * constructor Assertion: constructs CertificateEncodingException when 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCause, getMessage
     * constructor Assertion: constructs CertificateEncodingException when 
     * <code>cause</code> is null 
     */ 
    public void testCertificateEncodingException04() { 
        Throwable cause = null;
        CertificateEncodingException tE = new CertificateEncodingException(
                cause);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    } 
 
    /** 
     * Test for <code>CertificateEncodingException(Throwable)</code> 
     * constructor Assertion: constructs CertificateEncodingException when 
     * <code>cause</code> is not null 
     */ 
    public void testCertificateEncodingException05() { 
        CertificateEncodingException tE = new CertificateEncodingException(
                tCause);
        if (tE.getMessage() != null) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
    public void save(OutputStream out) throws IOException {
 
        try { 
            cred.save(out);
        } catch (CertificateEncodingException e) {
            throw new ChainedIOException(e.getMessage(), e);
        } 
    } 
 
    /** 
     * Verifies the validity of the credentials. All certificate path validation is performed using trusted 
     * certificates in default locations. 
     *  
     * @exception GlobusCredentialException 
     *                if one of the certificates in the chain expired or if path validiation fails. 
     */ 
    public void verify() throws GlobusCredentialException { 
        try { 
            String caCertsLocation = "file:" + CoGProperties.getDefault().getCaCertLocations();
            String crlPattern = caCertsLocation + "/*.r*";
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:toString
            dOut.writeInt(cEnc.length);
            dOut.write(cEnc);
        } 
        catch (CertificateEncodingException ex)
        { 
            throw new IOException(ex.toString());
        } 
    } 
 
    private Certificate decodeCertificate(
        DataInputStream   dIn)
        throws IOException 
    { 
        String      type = dIn.readUTF();
        byte[]      cEnc = new byte[dIn.readInt()];
 
        dIn.readFully(cEnc);
 
        try 
        { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
            return new X509Principal(X509Name.getInstance(tbsCert.getIssuer()));
        } 
        catch (IOException e)
        { 
            throw new CertificateEncodingException(e.toString());
        } 
    } 
 
    /** 
     * return the subject of the given cert as an X509PrincipalObject. 
     */ 
    public static X509Principal getSubjectX509Principal( 
        X509Certificate cert)
        throws CertificateEncodingException 
    { 
        try 
        { 
            TBSCertificateStructure tbsCert = TBSCertificateStructure.getInstance(
                    ASN1Primitive.fromByteArray(cert.getTBSCertificate()));
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
        } 
 
        try { 
            bootstrap.setX509Cert(cert);
        } catch (CertificateEncodingException e) {
            throw new ContextBrokerException(e.getMessage(), e);
        } 
        try { 
            bootstrap.setKeypair(keypair);
        } catch (IOException e) {
            throw new ContextBrokerException(e.getMessage(), e);
        } 
 
        X500Principal subjectDN = cert.getSubjectX500Principal();
        String DN = subjectDN.getName(X500Principal.RFC2253);
        String globusDN = CertUtil.toGlobusID(DN, false);
        bootstrap.setBootstrapDN(globusDN);
 
        return bootstrap;
    } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getClass, getMessage
		try { 
			CertificateFactory cf = CertificateFactory.getInstance("X.509");
			 X509Certificate certificate = (X509Certificate)cf.generateCertificate(input);
			return certificate;
		} catch (CertificateEncodingException e) {
			Log.warning("Cannot decode certificate " + e.getClass().getName() + ": " + e.getMessage());
			throw new IOException("Cannot decode certificate " + e.getClass().getName() + ": " + e.getMessage());
		} catch (CertificateException e) {
			Log.warning("Cannot decode certificate " + e.getClass().getName() + ": " + e.getMessage());
			throw new IOException("Cannot decode certificate " + e.getClass().getName() + ": " + e.getMessage());
		}  
	} 
 
	@Override 
	protected void writeObjectImpl(OutputStream output) throws ContentEncodingException, IOException {
		if (null == data()) 
			throw new ContentNotReadyException("No content available to save for object " + getBaseName()); 
		byte[] encoded;
		try { 
			encoded = certificate().getEncoded();
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
			new AlgorithmIdentifier(OIDLookup.getDigestOID(digestAlgorithm));
		DigestInfo info = new DigestInfo(digestAlg, theDigest);
		try { 
			return CryptoUtil.encode(info);
		} catch (CertificateEncodingException e) {
			Log.warning("Exception encoding digest as digest info using standard algorithms: " + e.getMessage());
			Log.warningStackTrace(e);
			// DKS TODO what to actually throw 
			return new byte[0]; 
		} 
	} 
 
	/** 
	 * Returns the DigestInfo corresponding to a specified array of bytes. 
	 * @param encodedDigest the array of bytes. 
	 * @return the corresponding DigestInfo. 
	 * @throws CertificateEncodingException 
	 */ 
	public static DigestInfo digestDecoder(byte [] encodedDigest) throws CertificateEncodingException {
		DERObject di = CryptoUtil.decode(encodedDigest);
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getClass, getMessage
		// Doesn't give us a good opportunity to check whether it's of type KEY. TODO 
		try { 
			byte [] contentBytes = DataUtils.getBytesFromStream(input);
			return CryptoUtil.getPublicKey(contentBytes);
		} catch (CertificateEncodingException e) {
			Log.severe("Cannot decode public key " + e.getClass().getName() + ": " + e.getMessage());
			Log.severe("Blockname : " + ((CCNInputStream)input).currentSegmentName());
			throw new IOException("Cannot decode public key " + e.getClass().getName() + ": " + e.getMessage());
		} catch (InvalidKeySpecException e) {
			Log.warning("Cannot decode public key from block: " + ((CCNInputStream)input).currentSegmentName() + "  " + e.getClass().getName() + ": " + e.getMessage());
			throw new IOException("Cannot decode public key " + e.getClass().getName() + ": " + e.getMessage());
		} 
	} 
 
	@Override 
	protected void writeObjectImpl(OutputStream output) throws ContentEncodingException, IOException {
		if (null == data()) 
			throw new ContentNotReadyException("No content available to save for object " + getBaseName()); 
		byte [] encoded = data().getEncoded();
		output.write(encoded);
5
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 CertificateEncodingException Methods: