Ejemplo n.º 1
0
 /** Parse the key. Called by X509Key. */
 protected void parseKeyBits() throws InvalidKeyException {
   try {
     AlgorithmParameters algParams = this.algid.getParameters();
     params = algParams.getParameterSpec(ECParameterSpec.class);
     w = ECParameters.decodePoint(key, params.getCurve());
   } catch (IOException e) {
     throw new InvalidKeyException("Invalid EC key", e);
   } catch (InvalidParameterSpecException e) {
     throw new InvalidKeyException("Invalid EC key", e);
   }
 }
Ejemplo n.º 2
0
 void implInit(
     int opmode, Key key, AlgorithmParameters params, SecureRandom random, CipherSpi cipherImpl)
     throws InvalidKeyException, InvalidAlgorithmParameterException {
   AlgorithmParameterSpec paramSpec = null;
   if (params != null) {
     try {
       paramSpec = params.getParameterSpec(PBEParameterSpec.class);
     } catch (InvalidParameterSpecException ipse) {
       throw new InvalidAlgorithmParameterException("requires PBE parameters");
     }
   }
   implInit(opmode, key, paramSpec, random, cipherImpl);
 }
Ejemplo n.º 3
0
 // see JCE spec
 protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random)
     throws InvalidKeyException, InvalidAlgorithmParameterException {
   byte[] ivValue;
   if (params != null) {
     try {
       IvParameterSpec ivSpec = (IvParameterSpec) params.getParameterSpec(IvParameterSpec.class);
       ivValue = ivSpec.getIV();
     } catch (InvalidParameterSpecException e) {
       throw new InvalidAlgorithmParameterException("Could not decode IV", e);
     }
   } else {
     ivValue = null;
   }
   implInit(opmode, key, ivValue, random);
 }