Package java.security.cert

Examples of java.security.cert.CertificateEncodingException


      setSignatureAlgorithm(sigAlgID);

      sig.update(tbsCertificate_.getEncoded());
      setSignature(sig.sign());
  } catch (CorruptedCodeException cce) {
      throw new CertificateEncodingException(
        "Cought CorruptedCodeException: " + cce.getMessage());
  }
    }
View Full Code Here


      bos.close();
  } catch (IOException e) {
      System.err.println("getenc Internal error: shouldn't happen!");
      e.printStackTrace();
  } catch (ASN1Exception e) {
      throw new CertificateEncodingException(e.getMessage());
  }
  return bos.toByteArray();

    }
View Full Code Here

  try {
      nval.encode(new DEREncoder(baos));
      extnValue.setByteArray(baos.toByteArray());
  } catch (Exception e) {
      throw new CertificateEncodingException(e.getMessage());
  }
    }
View Full Code Here

      baos.close();
  } catch (IOException e) {
      System.out.println("internal error:");
      e.printStackTrace();
  } catch (ASN1Exception e) {
      throw new CertificateEncodingException(e.getMessage());
  }
  return res;
    }
View Full Code Here

                return ((DERBitString) o).intValue();
            } else {
                throw new CertificateException("unknown type from ASN1InputStream.readObject: " + o);
            }
        } catch (IOException ioe) {
            throw new CertificateEncodingException(ioe.getMessage(), ioe);
        }
    }
View Full Code Here

            // according to PkiPath format
            while (li.hasPrevious()) {
                X509Certificate cert = li.previous();
                // check for duplicate cert
                if (certs.lastIndexOf(cert) != certs.indexOf(cert)) {
                    throw new CertificateEncodingException
                        ("Duplicate Certificate");
                }
                // get encoded certificates
                byte[] encoded = cert.getEncoded();
                bytes.write(encoded);
            }

            // Wrap the data in a SEQUENCE
            DerOutputStream derout = new DerOutputStream();
            derout.write(DerValue.tag_SequenceOf, bytes);
            return derout.toByteArray();

        } catch (IOException ioe) {
           CertificateEncodingException ce = new CertificateEncodingException
                ("IOException encoding PkiPath data: " + ioe);
           ce.initCause(ioe);
           throw ce;
        }
    }
View Full Code Here

                             new SignerInfo[0]);
        DerOutputStream derout = new DerOutputStream();
        try {
            p7.encodeSignedData(derout);
        } catch (IOException ioe) {
            throw new CertificateEncodingException(ioe.getMessage());
        }
        return derout.toByteArray();
    }
View Full Code Here

        if (PKIPATH_ENCODING.equals(encoding)) {
            return encodePKIPATH();
        } else if (PKCS7_ENCODING.equals(encoding)) {
            return encodePKCS7();
        } else {
            throw new CertificateEncodingException("unsupported encoding");
        }
    }
View Full Code Here

            cert.sign(privateKey, this.sigAlg);

            return (X509Certificate)cert;

        } catch (IOException e) {
             throw new CertificateEncodingException("getSelfCert: " +
                                                    e.getMessage());
        }
    }
View Full Code Here

                DerOutputStream tmp = new DerOutputStream();
                emit(tmp);
                encoded = tmp.toByteArray();
            }
        } catch (IOException ex) {
            throw new CertificateEncodingException(ex.toString());
        }
        return encoded;
    }
View Full Code Here

TOP

Related Classes of java.security.cert.CertificateEncodingException

Copyright © 2018 www.massapicom. 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.