digest

Can I serialize a ruby Digest::SHA1 instance object?

大憨熊 提交于 2019-12-06 12:46:19
G'day people, I am re-implementing an existent custom file upload service in ruby (sinatra) with redis as a backing store. Client calculates a SHA1 hash and initiates an upload uploads max 64K chunks until finished Server appends chunks to file calculates SHA1 hash of complete file to verify correct receipt Now, what I am hoping to do is use ruby (1.9.3) Digest::SHA1 << (update) operator on each chunk, (rather than having to read the ENTIRE file from scratch at the end). [Large files > 1GB]. Unfortunately Digest::SHA1 and Marshal.dump aren't compatible 1.9.3p125 :001 > require 'digest' => true

How to sign xml with X509 cert, add digest value and signature to xml template

风格不统一 提交于 2019-12-06 12:13:54
I am quite new to C# and especially new to Signing with X509. I have an xml template in which I have to add the certificate used (done) and sign the timestamp (TS-1), the binary security token and the body (id-1). Furthermore, I need to write (e.g. replace placeholders) with the digest value of these 3 elements and add the signature value. However, I do not really understand the concept, e.g. how to do this. I read a couple of websites, e.g. signing a xml document with x509 certificate but I cannot adapt the code to my problem. Here is what I tried: public static string SignXml(string template

Apache Http Digest Authentication using Java

心已入冬 提交于 2019-12-06 05:05:28
I am currently working on a Java project and I can't get the http digest authentication working. I tried using the Apache website, but it didn't help. I have a site that requires HTTP digest authentication. DefaultHttpClient httpclient = new DefaultHttpClient(); String hostUrl = "http://somewebsite.com"; String postUrl = "http://somewebsite.com/request"; HttpPost httpPost = new HttpPost(postUrl); String username = "hello"; String password = "world"; HttpHost targetHost = new HttpHost(hostUrl); httpclient.getCredentialsProvider().setCredentials( new AuthScope(hostUrl, AuthScope.ANY_PORT), new

Implement Digest authentication via HttpWebRequest in C#

两盒软妹~` 提交于 2019-12-05 11:01:30
Does anyone know how to screen scrape web-sites that use digest http authentication? I use code like this: var request = (HttpWebRequest)WebRequest.Create(SiteUrl); request.Credentials=new NetworkCredential(Login, Password) I'm able to access the site's mainpage, but when I try to surf to any other pages (using another request with the same credentials) I get "HTTP/1.1 400 Bad Request" error. I used Fiddler to compare requests of my C# application with Mozilla Firefox requests. 2 URLs that I try to access are: https://mysiteurl/forum/index.php https://mysiteurl/forum/viewforum.php?f=4&sid

Converting a byte [] to PrivateKey in java for digital signature

[亡魂溺海] 提交于 2019-12-05 10:06:59
问题 I need to digitally sign a String using the SHA-1 digest algorithm first and then apply the RSA algorithm, using a PrivateKey to sign it. I already have the PrivateKey stored in my database as data type char(250) in base64. My problem is that I don't know how to convert it into a PrivateKey for using it for signing in: Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, privateKey); byte[] cipherText = cipher.doFinal(digest); Digest was an array of bytes to which I

Why would HMAC SHA-1 return a different digest with the same input?

谁说我不能喝 提交于 2019-12-05 00:24:58
问题 I am trying to build a working encrypted signature for the Amazon S3 web service, writing a connection library using Objective C. I have run into HMAC SHA-1 digest problems with the ObjC code, so I'm putting that to the side and looking at existing, working Perl code, to try to troubleshoot digest creation. I am testing HMAC SHA-1 digest output from the s3ls command of the Net::Amazon::S3 package and comparing that against the _encode subroutine that I pulled out and put into its own perl

Tomcat Digest with Manager WebApp

大兔子大兔子 提交于 2019-12-04 14:06:59
问题 I'm trying to get a digest password setup for the tomcat manager application. I've got <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" digest="MD5"/> in my tomcat server.xml changed the manager web application's web.xml to use digest and changed the realm name to TESTING: <login-config> <auth-method>DIGEST</auth-method> <realm-name>TESTING</realm-name> </login-config> I then used the included bat file to generate the md5 hash: C:\tomcat6\bin>digest

C# Calculate and verify SHA256 value for SEPA (XML) paymentfile

徘徊边缘 提交于 2019-12-04 12:51:39
i am struggling with the same issue like Markus Dreyer: C# Calculate SHA256 value for SEPA (XML) paymentfile According to the DFÜ Agreement i have to calculate a sha256 hash value: The hash value is created using the entire contained document, including the opening and closing tag. The document is canonicalized according to Canonical XML, version 1.0. ( http://www.w3.org/TR/2001/REC-xml-c14n-20010315 ). In the case of included documents, the canonisation has also to be executed accord-ing to the main document. SHA-256 is used as hash algorithm. This is a sample valid xml File ( exported from

HTTP Digest Authentication

╄→гoц情女王★ 提交于 2019-12-04 09:09:24
问题 I want to use HTTP Digest Authentication with a central database that stores usernames and encrypted passwords. These data should be used by different servers like Apache httpd or Tomcat for example. The clients will be humans with browsers and other applications communicating in a RESTful way. As far as I understand I could not use a table with hashed passwords. It is only possibly to store HA1 = MD5(username:realm:password) where a clear text password is required - correct? On the other

Bottle.py HTTP Auth?

微笑、不失礼 提交于 2019-12-04 08:27:39
问题 How can I get my bottle.py app (Running in Paste or Cherrypy) to do HTTP (basic or digest) authentication? - I need to secure it, but cant find a any HOWTOs. 回答1: bottle has a built in auth_basic decorator that can be used on a view: from bottle import auth_basic, request, route def check(user, pw): # Check user/pw here and return True/False @route('/') @auth_basic(check) def home(): return { 'data': request.auth } 回答2: There are some libraries on GitHub like https://github.com