Ejemplo n.º 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());
 }
Ejemplo n.º 2
0
 // return a string representation of this key for debugging
 public String toString() {
   return "Sun EC public key, "
       + params.getCurve().getField().getFieldSize()
       + " bits\n  public x coord: "
       + w.getAffineX()
       + "\n  public y coord: "
       + w.getAffineY()
       + "\n  parameters: "
       + params;
 }
Ejemplo n.º 3
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);
   }
 }