]> git.cryptolib.org Git - arm-crypto-lib.git/blobdiff - rsa/rsa_basic.h
first idea of RSA (PKCS#1 v1.5)
[arm-crypto-lib.git] / rsa / rsa_basic.h
diff --git a/rsa/rsa_basic.h b/rsa/rsa_basic.h
new file mode 100644 (file)
index 0000000..a8a2dc8
--- /dev/null
@@ -0,0 +1,48 @@
+/* rsa_basic.h */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef RSA_BASIC_H_
+#define RSA_BASIC_H_
+
+#include "bigint.h"
+
+typedef struct {
+       bigint_t* exponent;
+       bigint_t* modulus;
+} rsa_publickey_t;
+
+typedef struct {
+       bigint_t* exponent;
+       bigint_t* modulus;
+} rsa_privatekey_t;
+
+
+typedef struct {
+       bigint_t* public_exponent;
+       bigint_t* private_exponent;
+       bigint_t* modulus;
+} rsa_fullkey_t;
+
+
+void rsa_enc(bigint_t* data, rsa_publickey_t* key);
+void rsa_dec(bigint_t* data, rsa_privatekey_t* key);
+void rsa_os2ip(bigint_t* dest, const void* data, uint32_t length_B);
+void rsa_i2osp(void* dest, bigint_t* src, uint16_t* out_length_B);
+
+#endif /* RSA_BASIC_H_ */