src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java

Print this page




 347                 );
 348             } catch (PrivilegedActionException pae) {
 349                 throw new KeyException("ECKeyValue not supported",
 350                                         pae.getException());
 351             }
 352             Object[] args = new Object[] { ecPoint, ecParams.getCurve() };
 353             try {
 354                 ecPublicKey = (byte[])encodePoint.invoke(null, args);
 355             } catch (IllegalAccessException iae) {
 356                 throw new KeyException(iae);
 357             } catch (InvocationTargetException ite) {
 358                 throw new KeyException(ite);
 359             }
 360         }
 361 
 362         EC(Element dmElem) throws MarshalException {
 363             super(dmElem);
 364         }
 365 
 366         void getMethods() throws ClassNotFoundException, NoSuchMethodException {
 367             Class c  = Class.forName("sun.security.ec.ECParameters");
 368             Class[] params = new Class[] { ECPoint.class, EllipticCurve.class };

 369             encodePoint = c.getMethod("encodePoint", params);
 370             params = new Class[] { ECParameterSpec.class };
 371             getCurveName = c.getMethod("getCurveName", params);
 372             params = new Class[] { byte[].class, EllipticCurve.class };
 373             decodePoint = c.getMethod("decodePoint", params);
 374             c  = Class.forName("sun.security.ec.NamedCurve");
 375             params = new Class[] { String.class };
 376             getECParameterSpec = c.getMethod("getECParameterSpec", params);
 377         }
 378 
 379         void marshalPublicKey(Node parent, Document doc, String dsPrefix,
 380                               DOMCryptoContext context)
 381             throws MarshalException
 382         {
 383             String prefix = DOMUtils.getNSPrefix(context, XMLDSIG_11_XMLNS);
 384             Element ecKeyValueElem = DOMUtils.createElement(doc, "ECKeyValue",
 385                                                             XMLDSIG_11_XMLNS,
 386                                                             prefix);
 387             Element namedCurveElem = DOMUtils.createElement(doc, "NamedCurve",
 388                                                             XMLDSIG_11_XMLNS,
 389                                                             prefix);
 390             Element publicKeyElem = DOMUtils.createElement(doc, "PublicKey",
 391                                                            XMLDSIG_11_XMLNS,
 392                                                            prefix);
 393             Object[] args = new Object[] { ecParams };
 394             try {
 395                 String oid = (String) getCurveName.invoke(null, args);




 347                 );
 348             } catch (PrivilegedActionException pae) {
 349                 throw new KeyException("ECKeyValue not supported",
 350                                         pae.getException());
 351             }
 352             Object[] args = new Object[] { ecPoint, ecParams.getCurve() };
 353             try {
 354                 ecPublicKey = (byte[])encodePoint.invoke(null, args);
 355             } catch (IllegalAccessException iae) {
 356                 throw new KeyException(iae);
 357             } catch (InvocationTargetException ite) {
 358                 throw new KeyException(ite);
 359             }
 360         }
 361 
 362         EC(Element dmElem) throws MarshalException {
 363             super(dmElem);
 364         }
 365 
 366         void getMethods() throws ClassNotFoundException, NoSuchMethodException {
 367             Class<?> c  = Class.forName("sun.security.ec.ECParameters");
 368             Class<?>[] params = new Class<?>[] { ECPoint.class,
 369                                                  EllipticCurve.class };
 370             encodePoint = c.getMethod("encodePoint", params);
 371             params = new Class<?>[] { ECParameterSpec.class };
 372             getCurveName = c.getMethod("getCurveName", params);
 373             params = new Class<?>[] { byte[].class, EllipticCurve.class };
 374             decodePoint = c.getMethod("decodePoint", params);
 375             c  = Class.forName("sun.security.ec.NamedCurve");
 376             params = new Class<?>[] { String.class };
 377             getECParameterSpec = c.getMethod("getECParameterSpec", params);
 378         }
 379 
 380         void marshalPublicKey(Node parent, Document doc, String dsPrefix,
 381                               DOMCryptoContext context)
 382             throws MarshalException
 383         {
 384             String prefix = DOMUtils.getNSPrefix(context, XMLDSIG_11_XMLNS);
 385             Element ecKeyValueElem = DOMUtils.createElement(doc, "ECKeyValue",
 386                                                             XMLDSIG_11_XMLNS,
 387                                                             prefix);
 388             Element namedCurveElem = DOMUtils.createElement(doc, "NamedCurve",
 389                                                             XMLDSIG_11_XMLNS,
 390                                                             prefix);
 391             Element publicKeyElem = DOMUtils.createElement(doc, "PublicKey",
 392                                                            XMLDSIG_11_XMLNS,
 393                                                            prefix);
 394             Object[] args = new Object[] { ecParams };
 395             try {
 396                 String oid = (String) getCurveName.invoke(null, args);