DSAKeyValuepublic class DSAKeyValue extends SignatureElementProxy implements KeyValueContent
Fields Summary |
---|
static Logger | log{@link java.util.logging} logging facility |
Constructors Summary |
---|
public DSAKeyValue(Element element, String BaseURI)Constructor DSAKeyValue
super(element, BaseURI);
| public DSAKeyValue(Document doc, BigInteger P, BigInteger Q, BigInteger G, BigInteger Y)Constructor DSAKeyValue
super(doc);
XMLUtils.addReturnToElement(this._constructionElement);
this.addBigIntegerElement(P, Constants._TAG_P);
this.addBigIntegerElement(Q, Constants._TAG_Q);
this.addBigIntegerElement(G, Constants._TAG_G);
this.addBigIntegerElement(Y, Constants._TAG_Y);
| public DSAKeyValue(Document doc, Key key)Constructor DSAKeyValue
super(doc);
XMLUtils.addReturnToElement(this._constructionElement);
if (key instanceof java.security.interfaces.DSAPublicKey) {
this.addBigIntegerElement(((DSAPublicKey) key).getParams().getP(),
Constants._TAG_P);
this.addBigIntegerElement(((DSAPublicKey) key).getParams().getQ(),
Constants._TAG_Q);
this.addBigIntegerElement(((DSAPublicKey) key).getParams().getG(),
Constants._TAG_G);
this.addBigIntegerElement(((DSAPublicKey) key).getY(),
Constants._TAG_Y);
} else {
Object exArgs[] = { Constants._TAG_DSAKEYVALUE,
key.getClass().getName() };
throw new IllegalArgumentException(I18n
.translate("KeyValue.IllegalArgument", exArgs));
}
|
Methods Summary |
---|
public java.lang.String | getBaseLocalName()
return Constants._TAG_DSAKEYVALUE;
| public java.security.PublicKey | getPublicKey()
try {
DSAPublicKeySpec pkspec =
new DSAPublicKeySpec(this
.getBigIntegerFromChildElement(Constants._TAG_Y, Constants
.SignatureSpecNS), this
.getBigIntegerFromChildElement(Constants._TAG_P, Constants
.SignatureSpecNS), this
.getBigIntegerFromChildElement(Constants._TAG_Q, Constants
.SignatureSpecNS), this
.getBigIntegerFromChildElement(Constants
._TAG_G, Constants.SignatureSpecNS));
KeyFactory dsaFactory = KeyFactory.getInstance("DSA");
PublicKey pk = dsaFactory.generatePublic(pkspec);
return pk;
} catch (NoSuchAlgorithmException ex) {
throw new XMLSecurityException("empty", ex);
} catch (InvalidKeySpecException ex) {
throw new XMLSecurityException("empty", ex);
}
|
|