Exemplo n.º 1
0
 /**
  * Adds a {@code Certificate} to this {@code Identity}.
  *
  * @param certificate the {@code Certificate} to be added to this {@code Identity}.
  * @throws KeyManagementException if the certificate is not valid.
  */
 public void addCertificate(Certificate certificate) throws KeyManagementException {
   PublicKey certPK = certificate.getPublicKey();
   if (publicKey != null) {
     if (!checkKeysEqual(publicKey, certPK)) {
       throw new KeyManagementException("Cert's public key does not match Identity's public key");
     }
   } else {
     publicKey = certPK;
   }
   if (certificates == null) {
     certificates = new Vector<Certificate>();
   }
   certificates.add(certificate);
 }