Added 2 examples
authorWerner Koch <wk@gnupg.org>
Tue, 31 Jul 2001 12:25:23 +0000 (12:25 +0000)
committerWerner Koch <wk@gnupg.org>
Tue, 31 Jul 2001 12:25:23 +0000 (12:25 +0000)
complus/Makefile.am
complus/vbtest.html [new file with mode: 0644]
complus/vbtest.vbs [new file with mode: 0644]

index 9da5b4b..45c3dc4 100644 (file)
@@ -24,7 +24,7 @@
 # system with an install MIDL and run the command
 #   midl /nocpp gpgcom.idl
 # Sorry, there is no other way yet.  
-EXTRA_DIST = gpgcom.idl gpgcom.tlb gpgcom.rc
+EXTRA_DIST = gpgcom.idl gpgcom.tlb gpgcom.rc vbtest.html vbtest.vbs
 
 # No need to install this because we are cross-compiling anyway.
 noinst_PROGRAMS = gpgcom tgpgcom 
diff --git a/complus/vbtest.html b/complus/vbtest.html
new file mode 100644 (file)
index 0000000..03df463
--- /dev/null
@@ -0,0 +1,47 @@
+<html>
+<head><title>g10 code - GPGCOM test</title>
+
+<object id="gpg"
+        classid="CLSID:3811fd40-7f72-11d5-8c9e-0080ad190cd5">
+</object>
+
+<script language="VBScript">
+Sub encrypt_text
+     On error resume next
+     Dim TheForm, plain
+
+     set TheForm = Document.forms ("MyForm")
+     gpg.armor = True
+     gpg.plaintext = TheForm.clear.value
+     gpg.ClearRecipients
+     gpg.AddRecipient TheForm.recp.value
+     Err.Clear
+     gpg.Encrypt
+     if Err <> 0 then
+         TheForm.encoded.value = "Error: " & CStr(Err.Number)
+     else
+         TheForm.encoded.value = gpg.ciphertext
+     end if
+end sub
+</script>
+</head>
+<body>
+<h1>Silly Gpgcom test page</h1>
+
+<form id="MyForm">
+<textarea name="clear" rows = 3 cols=40>Please enter the text here</textarea>
+<p>
+Encrypt for <input name="recp" value="alice">
+<input type="button" name="MyAction" value="Encrypt" 
+       language="VBScript" onclick="encrypt_text()">
+<p>
+<textarea name="encoded" rows=10 cols=75></textarea>
+</form>
+
+<p>
+
+</body>
+</html>     
+
+
+
diff --git a/complus/vbtest.vbs b/complus/vbtest.vbs
new file mode 100644 (file)
index 0000000..7ea346d
--- /dev/null
@@ -0,0 +1,39 @@
+' Demo script to generate a RFC2015 compliant message using Gpgcom
+Dim gpg, body, crlf
+
+crlf = chr(10) & chr(13)
+
+' Create out Gpgcom object
+set gpg = CreateObject("Gpgcom.Gpgme")
+' We must use the ASCII armor and switch to textmode
+gpg.armor = true
+gpg.textmode = true
+
+' Set the secret message
+gpg.plaintext = "This is the secret message."  'or: InputBox('Enter message:")
+
+' Set the Recipient.  You may also use a keyID or an fingerprint
+gpg.addrecipient "alice"
+
+' And encrypt the stuff
+gpg.encrypt
+
+' Build the MIME message
+body = "Content-Type: multipart/encrypted; boundary=" 
+body = body & Chr(34) & "=-=-=-=" & Chr(34) & crlf & "    protocol=" & Chr(34)
+body = body & "application/pgp-encrypted" & Chr(34) & crlf & crlf
+body = body & "--=-=-=-=" & crlf
+body = body & "Content-Type: application/pgp-encrypted" & crlf & crlf
+body = body & "Version: 1" & crlf & crlf
+body = body & "--=-=-=-=" & crlf
+body = body & "Content-Type: application/octet-stream" & crlf & crlf
+body = body & gpg.ciphertext 
+body = body & "--=-=-=-=--" & crlf 
+
+' And display it
+Print body
+
+' output function for the windows scripting host
+sub Print(x)
+     WScript.Echo x
+end sub