- Android (api level 18+)
cordova plugin add https://github.com/rd-uk/cordova-plugin-rduksecurity.git
Generates a certificate stored in KeyStore for android device. The public key is passed to the success callback as a Base64-encoded String
.
Note: if alias already exists, the existing public key is passed to the success callback.
var onSuccess = function(data) {
/* ... */
};
var onError = function(message) {
/* ... */
};
security.certificate.generate('alias...', onSuccess, onError);
Generates a MD5 hash of message, passed to the success callback as Base64-encoded String
.
var onSuccess = function(data) {
console.log(data); // will output: uVkG1pQIp3QD8df1FdvMBw==
};
var onError = function(message) {
/* Oops, something goes wrong... */
};
security.digest.md5digest('rduk', onSuccess, onError);
Generates a SHA-1 hash of message, passed to the success callback as Base64-encoded String
.
var onSuccess = function(data) {
console.log(data); // will output: xhZASyUDRjjsAZVzRKp16OpERK0=
};
var onError = function(message) {
/* Oops, something goes wrong... */
};
security.digest.sha1digest('rduk', onSuccess, onError);
Generates a SHA-256 hash of message, passed to the success callback as Base64-encoded String
.
var onSuccess = function(data) {
console.log(data); // will output: qoNyp5fmrKx26h69RVjP/H4TtPQtxGXTWlDC/MRiCjo=
};
var onError = function(message) {
/* Oops, something goes wrong... */
};
security.digest.sha256digest('rduk', onSuccess, onError);
var onSuccess = function(data) {
/* ... */
};
var onError = function(message) {
/* ... */
};
security.digest.sha256digest(
'my message to sign',
function(digest) {
security.message.sign(
digest, 'certificate alias...', onSuccess, onError);
},
, onError);
var onSuccess = function(data) {
/* ... */
};
var onError = function(message) {
/* ... */
};
security.digest.sha256digest(
'my message to verify',
function(digest) {
security.message.verify(
digest, 'signature...', 'certificate alias...', onSuccess, onError);
},
, onError);