Пример #1
0
 /** Construct a key from its components. Used by the ECKeyFactory and SunPKCS11. */
 public ECPublicKeyImpl(ECPoint w, ECParameterSpec params) throws InvalidKeyException {
   this.w = w;
   this.params = params;
   // generate the encoding
   algid = new AlgorithmId(AlgorithmId.EC_oid, ECParameters.getAlgorithmParameters(params));
   key = ECParameters.encodePoint(w, params.getCurve());
 }
Пример #2
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);
   }
 }