This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pkcs1v1pad key msg = | |
let blen = key.RSA.size/8 | |
and mlen = String.length msg in | |
let padlen = blen - mlen in | |
if padlen > 3 then begin | |
let res = String.make padlen (char_of_int 255) in | |
res.[0] <- (char_of_int 0); | |
res.[1] <- (char_of_int 1); | |
res.[padlen - 1] <- (char_of_int 0); | |
res ^ msg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ocaml | |
(* | |
Prerequisites: Findlib, Pcre, Cryptokit | |
Usage: openssl rsa -in privkey.pem -text | ./pem2ck.ml > privkey.cryptokit | |
*) | |
#use "topfind" ;; | |
#require "pcre" ;; | |
#require "cryptokit" ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Повертає монаду *) | |
let return x = Some x ;; | |
(* Перевіряє монаду на наявність значення та повертає результат | |
застосування функції до цього значення, інакше повертає *) | |
let (>>=) m f = | |
match m with | |
| None -> None | |
| Some x -> f x ;; |
NewerOlder