Package br.net.woodstock.rockframework.xml.dom

Examples of br.net.woodstock.rockframework.xml.dom.XmlElement


    Assert.notNull(crypter, "crypter");
    Assert.notNull(outputStream, "outputStream");
    try {
      SecretKey key = crypter.getSecretKey();
      XmlDocument document = new XmlDocument(CrypterIOHelper.SYNC_CRYPTER_ELEMENT);
      XmlElement root = document.getRoot();
      root.addElement(CrypterIOHelper.KEY_ALGORITHM_ELEMENT).setData(crypter.getAlgorithm());
      CrypterIOHelper.addKey(root, CrypterIOHelper.SECRET_KEY_ELEMENT, key);
      document.write(outputStream);
    } catch (IOException e) {
      throw new CrypterException(e);
    }
View Full Code Here


  @Override
  public AsyncCrypter read(final InputStream inputStream) {
    Assert.notNull(inputStream, "inputStream");
    try {
      XmlDocument document = XmlDocument.read(inputStream);
      XmlElement root = document.getRoot();
      String algorithm = CrypterIOHelper.getElementData(root, CrypterIOHelper.KEY_ALGORITHM_ELEMENT);

      KeyFactory factory = KeyFactory.getInstance(algorithm);
      PrivateKey privateKey = null;
      PublicKey publicKey = null;
View Full Code Here

  @Override
  public SyncCrypter read(final InputStream inputStream) {
    Assert.notNull(inputStream, "inputStream");
    try {
      XmlDocument document = XmlDocument.read(inputStream);
      XmlElement root = document.getRoot();
      String algorithm = CrypterIOHelper.getElementData(root, CrypterIOHelper.KEY_ALGORITHM_ELEMENT);
      byte[] bytes = CrypterIOHelper.getKey(root, CrypterIOHelper.SECRET_KEY_ELEMENT);

      SecretKeySpec keySpec = new SecretKeySpec(bytes, algorithm);
      SyncCrypter crypter = new SyncCrypter(keySpec);
View Full Code Here

    try {
      PrivateKey privateKey = crypter.getPrivateKey();
      PublicKey publicKey = crypter.getPublicKey();

      XmlDocument document = new XmlDocument(CrypterIOHelper.ASYNC_CRYPTER_ELEMENT);
      XmlElement root = document.getRoot();
      root.addElement(CrypterIOHelper.KEY_ALGORITHM_ELEMENT).setData(crypter.getAlgorithm());

      if (privateKey != null) {
        CrypterIOHelper.addKey(root, CrypterIOHelper.PRIVATE_KEY_ELEMENT, privateKey);
      } else {
        SecurityLog.getInstance().getLogger().info("Private key is null and not will be writed");
View Full Code Here

TOP

Related Classes of br.net.woodstock.rockframework.xml.dom.XmlElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.