Package java.security

Examples of java.security.KeyException


        } else if (key instanceof RSAPublicKey) {
            RSAPublicKey rkey = (RSAPublicKey) key;
            exponent = new DOMCryptoBinary(rkey.getPublicExponent());
            modulus = new DOMCryptoBinary(rkey.getModulus());
        } else {
            throw new KeyException("unsupported key algorithm: " +
                key.getAlgorithm());
        }
    }
View Full Code Here


        }
    }

    public PublicKey getPublicKey() throws KeyException {
        if (publicKey == null) {
            throw new KeyException("can't convert KeyValue to PublicKey");
        } else {
            return publicKey;
        }
    }
View Full Code Here

/* 521 */       Constructor ctor = secretKeySpecClass.getDeclaredConstructor(signature);
/* 522 */       secretKey = ctor.newInstance(args);
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 526 */       throw new KeyException("Failed to create SecretKeySpec from session key, msg=" + e.getMessage());
/*     */     }
/*     */     catch (Throwable e)
/*     */     {
/* 530 */       throw new KeyException("Unexpected exception during SecretKeySpec creation, msg=" + e.getMessage());
/*     */     }
/* 532 */     return secretKey;
/*     */   }
View Full Code Here

        Constructor ctor = secretKeySpecClass.getDeclaredConstructor(signature);
        secretKey = ctor.newInstance(args);
      }
      catch(Exception e)
      {
        throw new KeyException("Failed to create SecretKeySpec from session key, msg="+e.getMessage());
      }
      catch(Throwable e)
      {
         throw new KeyException("Unexpected exception during SecretKeySpec creation, msg="+e.getMessage());
      }
      return secretKey;
   }
View Full Code Here

  }

  /* Also throws SecurityException */
  X500PrivateCredential xpc = getPrivateCredential(head);
  if (xpc == null) {
      throw new KeyException(
    "Private key not found for certificate: " + head);
  }

  return xpc;
    }
View Full Code Here

                        new BigInteger(dsaKeyValue.getG()) );
                try {
                    KeyFactory fac = KeyFactory.getInstance("DSA");
                    return fac.generatePublic(spec);
                } catch (Exception ex) {
                    throw new KeyException(ex);
                }
            } else if ( o instanceof RSAKeyValue) {
                RSAKeyValue rsaKayValue = (RSAKeyValue) o;
               
                RSAPublicKeySpec spec = new RSAPublicKeySpec(
                        new BigInteger(rsaKayValue.getModulus()),
                        new BigInteger(rsaKayValue.getExponent()));
               
                try {
                    KeyFactory fac = KeyFactory.getInstance("RSA");
                    return fac.generatePublic(spec);
                } catch (Exception ex) {
                    throw new KeyException(ex);
                }
            }
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of java.security.KeyException

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.