All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jcp.xml.dsig.internal.dom.DOMCryptoBinary Maven / Gradle / Ivy

The newest version!
/*    */ package org.jcp.xml.dsig.internal.dom;
/*    */ 
/*    */ import com.sun.org.apache.xml.internal.security.utils.Base64;
/*    */ import java.math.BigInteger;
/*    */ import javax.xml.crypto.MarshalException;
/*    */ import javax.xml.crypto.dom.DOMCryptoContext;
/*    */ import org.w3c.dom.Document;
/*    */ import org.w3c.dom.Node;
/*    */ import org.w3c.dom.Text;
/*    */ 
/*    */ public final class DOMCryptoBinary extends DOMStructure
/*    */ {
/*    */   private final BigInteger bigNum;
/*    */   private final String value;
/*    */ 
/*    */   public DOMCryptoBinary(BigInteger bigNum)
/*    */   {
/* 45 */     if (bigNum == null) {
/* 46 */       throw new NullPointerException("bigNum is null");
/*    */     }
/* 48 */     this.bigNum = bigNum;
/*    */ 
/* 50 */     this.value = Base64.encode(bigNum);
/*    */   }
/*    */ 
/*    */   public DOMCryptoBinary(Node cbNode)
/*    */     throws MarshalException
/*    */   {
/* 60 */     this.value = cbNode.getNodeValue();
/*    */     try {
/* 62 */       this.bigNum = Base64.decodeBigIntegerFromText((Text)cbNode);
/*    */     } catch (Exception ex) {
/* 64 */       throw new MarshalException(ex);
/*    */     }
/*    */   }
/*    */ 
/*    */   public BigInteger getBigNum()
/*    */   {
/* 74 */     return this.bigNum;
/*    */   }
/*    */ 
/*    */   public void marshal(Node parent, String prefix, DOMCryptoContext context) throws MarshalException
/*    */   {
/* 79 */     parent.appendChild(DOMUtils.getOwnerDocument(parent).createTextNode(this.value));
/*    */   }
/*    */ }

/* Location:           E:\HYN\Java\trunk\ref\lib-dep\xmldsig\xmldsig.jar
 * Qualified Name:     org.jcp.xml.dsig.internal.dom.DOMCryptoBinary
 * JD-Core Version:    0.6.2
 */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy