fork-openpgpjs/test/parser.html
2011-12-16 13:37:49 +01:00

127 lines
5.7 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="../resources/jquery.min.js"></script>
<script type="text/javascript" src="../src/ciphers/hash/sha.js"></script>
<script type="text/javascript" src="../src/ciphers/hash/md5.js"></script>
<script type="text/javascript" src="../src/ciphers/hash/ripe-md.js"></script>
<!-- crypto libs -->
<script type="text/javascript" src="../src/ciphers/symmetric/aes.js"></script>
<script type="text/javascript" src="../src/ciphers/symmetric/cast5.js"></script>
<script type="text/javascript" src="../src/ciphers/symmetric/dessrc.js"></script>
<script type="text/javascript" src="../src/ciphers/symmetric/twofish.js"></script>
<script type="text/javascript" src="../src/ciphers/symmetric/blowfish.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/jsbn.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/jsbn2.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/dsa.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/elgamal.js"></script>
<script type="text/javascript" src="../src/ciphers/asymmetric/rsa.js"></script>
<script type="text/javascript" src="../src/ciphers/openpgp.crypto.js"></script>
<script type="text/javascript" src="../src/ciphers/openpgp.cfb.js"></script>
<!-- compression -->
<!-- encoding -->
<script type="text/javascript" src="../src/encoding/base64.js"></script>
<script type="text/javascript" src="../src/encoding/openpgp.encoding.asciiarmor.js"></script>
<script type="text/javascript" src="../src/encoding/openpgp.encoding.js"></script>
<!-- openpgp types -->
<script type="text/javascript" src="../src/type/openpgp.type.keyid.js"></script>
<script type="text/javascript" src="../src/type/openpgp.type.mpi.js"></script>
<script type="text/javascript" src="../src/type/openpgp.type.s2k.js"></script>
<!-- openpgp packets -->
<script type="text/javascript" src="../src/packet/openpgp.packet.compressed.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.encrypteddata.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.encryptedintegrityprotecteddata.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.encryptedsessionkey.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.keymaterial.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.literaldata.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.marker.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.modificationdetectioncode.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.onepasssignature.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.signature.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.userattribute.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.userid.js"></script>
<script type="text/javascript" src="../src/packet/openpgp.packet.js"></script>
<!-- openpgp impl. -->
<script type="text/javascript" src="../src/openpgp.js"></script>
<script type="text/javascript" src="../src/config/openpgp.config.js"></script>
<script type="text/javascript" src="../src/openpgp.keyring.js"></script>
<script type="text/javascript" src="../src/openpgp.msg.message.js"></script>
<script type="text/javascript" src="../src/openpgp.msg.privatekey.js"></script>
<script type="text/javascript" src="../src/openpgp.msg.publickey.js"></script>
<script type="text/javascript" src="../src/util/util.js"></script>
<!-- unit test -->
<script type="text/javascript" src="unittest.js"></script>
<script type="text/javascript" src="example-test.js"></script>
<title>OpenPGP.js testpage</title>
</head>
<body>
<style>
* {
font-family: monospace;
}
#debug, #testoutput {
border: 1px dotted #aaa;
background-color: #eee;
margin: 5px;
padding: 5px;
}
</style>
<script type="text/javascript">
openpgp.init();
// message function required by util.print_message, util.print_debug, util.print_warning
function showMessages(str) {
$('#debug').append(str);
}
function test() {
$('#testoutput').empty();
var value = $('input:radio[name=message_type]:checked').val();
var result = null;
if (value == 0) {
result = openpgp.read_message($('#testinput').val());
} else if (value == 1) {
result = openpgp.read_publicKey($('#testinput').val());
} else if (value == 2) {
result = openpgp.read_privateKey($('#testinput').val());
}
for (var i = 0; i < result.length; i++)
$('#testoutput').text(result[i].toString());
}
$(document).ready(function() {
$('#enabledebug').is(':checked') ? openpgp.config.debug = true : openpgp.config.debug = false;
});
</script>
<a href="index.html">Unit Tests</a> | <a href="parser.html">Parser</a> | <a href="encryption.html">Encryption / Decryption</a> | <a href="coverage.html">Coverage</a>
<p><input id="enabledebug" type="checkbox" onclick="($('#enabledebug').is(':checked') ? openpgp.config.debug = true : openpgp.config.debug = false)"> Print Debug Messages </p>
<h1>Parser</h1>
<input type="radio" name="message_type" value="0" checked="checked">OpenPGP Message |
<input type="radio" name="message_type" value="1">OpenPGP Public Key |
<input type="radio" name="message_type" value="2">OpenPGP Private Key<br>
<textarea id="testinput" cols="80" rows="25"></textarea><button onmousedown="test();" type="submit">parse</button>
<h2>Test output</h2>
<pre id="testoutput"></pre>
<!-- src/util/util.js print_debug() writes to -->
<h2>Messages</h2>
<div id="debug"></div>
</body>
</html>