Skip to content

Instantly share code, notes, and snippets.

@sargun
Created Sep 30, 2013
Embed
What would you like to do?
cqlsh:certie> CREATE TABLE IF NOT EXISTS certificates (
... parentCA varchar,
... commonName varchar,
... revoked timestamp,
... serial varint,
... dn varchar,
... notBefore timestamp,
... notAfter timestamp,
... cert blob,
... PRIMARY KEY (parentCA, revoked, commonName)
... );
<---INSERT NEW ROW--->
cqlsh:certie> SELECT parentca, revoked, commonname FROM certificates ;
parentca | revoked | commonname
----------+--------------------------+---------------
newca | 2023-09-25 03:26:33-0700 | sargun-laptop
(1 rows)
cqlsh:certie> BEGIN BATCH DELETE FROM certificates WHERE parentca='newca' AND commonName='sargun-laptop' AND revoked=1695637593000;INSERT INTO certificates(parentca,commonname,cert,dn,notafter,notbefore,serial,revoked) VALUES ('newca','sargun-laptop',0xaced00057372002d6a6176612e73656375726974792e636572742e436572746966696361746524436572746966696361746552657089276a9dc9ae3c0c0200025b0004646174617400025b424c0004747970657400124c6a6176612f6c616e672f537472696e673b7870757200025b42acf317f8060854e0020000787000000457308204533082033ba0030201020206014170ed00c5300d06092a864886f70d01010b0500307d310e300c06035504030c056e6577636131153013060355040a0c0c59616d6d65722c20496e632e310c300a060355040b0c0356504e311630140603550406130d53616e204672616e636973636f3116301406035504080c0d53616e204672616e636973636f3116301406035504070c0d53616e204672616e636973636f301e170d3133303932393232313132325a170d3136303932393232313132325a3078310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d53616e204672616e636973636f310f300d060355040a130659616d6d657231133011060355040b130a59616d6d65722056504e311630140603550403130d73617267756e2d6c6170746f7030820122300d06092a864886f70d01010105000382010f003082010a0282010100becb95bf56bdd0b3e1d9fe6ff2cb8ec7fccbfca69709c3e9c1cf11209bc7bbf61c262ad150414a6077408a03e21246102454d95091d5930ece58dd37ac3808e2359c059b8aacd21cc979c031fd9e560798635b02d7432c625a3916c1741f5823a4fa01bbbf3004733a40fc2f3826236d11de52c57cc8494b99fa855f52fbe7c2ada3be05438544c9e5acc0b860f0acad9bd011c311a8f6d496c4dd680ac32dc753099854dae93fa5899c7507d3e5a0a350d1cf03e5b1162e3d77d558cc2ae481110aec61cce0fd0de542dc8207a64077c0e594196165536b2d52f09a2fc607b94124953ca14e6246d7a6d9e285921af15432a38ee389d8c56a09eb7a771a15f70203010001a381dd3081da30090603551d1304023000301d0603551d0e04160414a7c2eee63e616c5aea397735f51532e486b420c13081ad0603551d230481a53081a2801418d048c194e5e72a39e84466471e46e75aa8c924a18181a47f307d3116301406035504070c0d53616e204672616e636973636f3116301406035504080c0d53616e204672616e636973636f311630140603550406130d53616e204672616e636973636f310c300a060355040b0c0356504e31153013060355040a0c0c59616d6d65722c20496e632e310e300c06035504030c056e65776361820601415ef4a91f300d06092a864886f70d01010b05000382010100351113ef82e78c77c14f6e671dcd6e43cdc07f1f45ed46e072504e3d791c4529b847a3473cd2b833d7136438d9695354e279d7d63327a844a52f5b90af0a25eb0626c679577a38acf4c07efe1a9ab156e68bf742d04c76d1dcade1d0a88c307c71ec58a86e01c462ece5745b32e8260d43dcd1bd3a52a38bf7fd34a518a87ada92b092f4c2b3f5c112a08ca33d60671e4ec9ee40dbb3b4598a12fe3345865a91fb5aa388a4fa42fce1a26bf12fcd9490865966941cc86acd003f2f51de106ff5bc2eff4970358846b0997382c03df3138525fba702584e0b61ed53ef28de60fc7b4dca277bb2dff77dcf6d6cf88456bd29a7ffafac0bb624c49e847810ca0eaa740005582e353039,'C=US,ST=California,L=San Francisco,O=Yammer,OU=Yammer VPN,CN=sargun-laptop',1475187082000,1380492682000,1380579082437,1380579115546);APPLY BATCH;
cqlsh:certie> SELECT parentca, revoked, commonname FROM certificates ;
parentca | revoked | commonname
----------+--------------------------+---------------
newca | 2013-09-30 15:11:55-0700 | sargun-laptop
newca | 2023-09-25 03:26:33-0700 | sargun-laptop
(2 rows)
Alternatively, doing the work outside of a transaction:
cqlsh:certie> DELETE FROM certificates WHERE parentca='newca' AND commonName='sargun-laptop' AND revoked=1695637593000;
cqlsh:certie> INSERT INTO certificates(parentca,commonname,cert,dn,notafter,notbefore,serial,revoked) VALUES ('newca','sargun-laptop',0xaced00057372002d6a6176612e73656375726974792e636572742e436572746966696361746524436572746966696361746552657089276a9dc9ae3c0c0200025b0004646174617400025b424c0004747970657400124c6a6176612f6c616e672f537472696e673b7870757200025b42acf317f8060854e0020000787000000457308204533082033b 16e636973636f3116301406035504080c0d53616e204672616e636973636f3116301406035504070c0d53616e204672616e636973636f301e170d3133303932393232313132325a170d3136303932393232313132325a3078310b30090603550406130255533113 170746f7030820122300d06092a864886f70d01010105000382010f003082010a0282010100becb95bf56bdd0b3e1d9fe6ff2cb8ec7fccbfca69709c3e9c1cf11209bc7bbf61c262ad150414a6077408a03e21246102454d95091d5930ece58dd37ac3808e2359c059b8aacd21cc979c031fd9e560798635b02d7432c625a3916c1741f5823a4fa01bbbf3004733a40fc2f3826236d11de52c57cc8494b99fa855f52fbe7c2ada3be05438544c9e5acc0b860f0acad9bd011c311a8f6d496c4dd680ac32dc753099854dae93fa5899c7507d3e5a0a350d1cf03e5b1162e3d77d558cc2ae481110aec61cce0fd0de542dc8207a64077c0e594196165536b2d52f09a2fc607b94124953ca14e6246d7a6d9e285921af15432a38ee389d8c56a09eb7a771a15f70203010001a381dd3081da30090603551d1304023000301d0603551d0e04160414a7c2eee63e616c5aea397735f51532e486b420c13081ad0603551d230481a53081a2801418d048c194e5e72a39e84466471e46e75aa8c924a18181a47f307d3116301406035504070c0d53616e204672616e636973636f3116301406035504080c0d53616e204672616e636973636f311630140603550406130d53616e204672616e636973636f310c300a060355040b0c0356504e31153013060355040a0c0c59616d6d65722c20496e632e310e300c06035504030c056e65776361820601415ef4a91f300d06092a864886f70d01010b05000382010100351113ef82e78c77c14f6e671dcd6e43cdc07f1f45ed46e072504e3d791c4529b847a3473cd2b833d7136438d9695354e279d7d63327a844a52f5b90af0a25eb0626c679577a38acf4c07efe1a9ab156e68bf742d04c76d1dcade1d0a88c307c71ec58a86e01c462ece5745b32e8260d43dcd1bd3a52a38bf7fd34a518a87ada92b092f4c2b3f5c112a08ca33d60671e4ec9ee40dbb3b4598a12fe3345865a91fb5aa388a4fa42fce1a26bf12fcd9490865966941cc86acd003f2f51de106ff5bc2eff4970358846b0997382c03df3138525fba702584e0b61ed53ef28de60fc7b4dca277bb2dff77dcf6d6cf88456bd29a7ffafac0bb624c49e847810ca0eaa740005582e353039,'C=US,ST=California,L=San Francisco,O=Yammer,OU=Yammer VPN,CN=sargun-laptop',1475187082000,1380492682000,1380579082437,1380579115546);
cqlsh:certie> SELECT parentca, revoked, commonname FROM certificates ;
parentca | revoked | commonname
----------+--------------------------+---------------
newca | 2013-09-30 15:11:55-0700 | sargun-laptop
(1 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment